gioser

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 498HTML 254C 19JavaScript 81339 Definiciones

⎇ 0.1.x benches/generated/wrapped_row_within_align_items_flex_start.rs Rust · 51 líneas · 1.7 KB Historia Quién tocó qué crudo

Rename sprawl to taffy (#134) 8936790d6 · Alice Cecile ·

1pub fn compute() {
2    let mut taffy = taffy::Taffy::new();
3    let node00 = taffy
4        .new_node(
5            taffy::style::Style {
6                size: taffy::geometry::Size {
7                    width: taffy::style::Dimension::Points(150f32),
8                    height: taffy::style::Dimension::Points(80f32),
9                    ..Default::default()
10                },
11                ..Default::default()
12            },
13            &[],
14        )
15        .unwrap();
16    let node01 = taffy
17        .new_node(
18            taffy::style::Style {
19                size: taffy::geometry::Size {
20                    width: taffy::style::Dimension::Points(80f32),
21                    height: taffy::style::Dimension::Points(80f32),
22                    ..Default::default()
23                },
24                ..Default::default()
25            },
26            &[],
27        )
28        .unwrap();
29    let node0 = taffy
30        .new_node(
31            taffy::style::Style { flex_wrap: taffy::style::FlexWrap::Wrap, ..Default::default() },
32            &[node00, node01],
33        )
34        .unwrap();
35    let node = taffy
36        .new_node(
37            taffy::style::Style {
38                flex_direction: taffy::style::FlexDirection::Column,
39                align_items: taffy::style::AlignItems::FlexStart,
40                size: taffy::geometry::Size {
41                    width: taffy::style::Dimension::Points(200f32),
42                    height: taffy::style::Dimension::Points(200f32),
43                    ..Default::default()
44                },
45                ..Default::default()
46            },
47            &[node0],
48        )
49        .unwrap();
50    taffy.compute_layout(node, taffy::geometry::Size::undefined()).unwrap();
51}