tawasuyu

tawasuyu/taffy

A high performance rust-powered UI layout library

HTML 231Rust 9TOML 3CSS 1345 Definitions

⎇ b91874d4e34ecc9054b468a338ffcae6f61a1b4a benches/generated/aspect_ratio_flex_column_fill_width.rs Rust · 28 lines · 1.0 KB History Who touched what raw

Fixes for aspect ratio and min/max sizes (#317) 610c92f31 · Nico Burns ·

1pub fn compute() {
2    #[allow(unused_imports)]
3    use taffy::prelude::*;
4    let mut taffy = taffy::Taffy::new();
5    let node0 = taffy
6        .new_leaf(taffy::style::Style {
7            size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Points(40f32) },
8            aspect_ratio: Some(2f32),
9            ..Default::default()
10        })
11        .unwrap();
12    let node = taffy
13        .new_with_children(
14            taffy::style::Style {
15                display: taffy::style::Display::Flex,
16                flex_direction: taffy::style::FlexDirection::Column,
17                align_items: Some(taffy::style::AlignItems::Start),
18                size: taffy::geometry::Size {
19                    width: taffy::style::Dimension::Points(100f32),
20                    height: taffy::style::Dimension::Points(100f32),
21                },
22                ..Default::default()
23            },
24            &[node0],
25        )
26        .unwrap();
27    taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap();
28}