tawasuyu

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 788HTML 740Markdown 12TOML 62536 Definitions

⎇ 9e53f03adea2b770d68954e404d2fa407dfc7d40 benches/generated/absolute_layout_in_wrap_reverse_column_container.rs Rust · 33 lines · 1.2 KB History Who touched what raw

Layout algorithm decoupling, Sizing Constraints & Perf Improvements (#246) ba4cd3c3b · Nico Burns ·

1pub fn compute() {
2    let mut taffy = taffy::Taffy::new();
3    let node0 = taffy
4        .new_with_children(
5            taffy::style::FlexboxLayout {
6                position_type: taffy::style::PositionType::Absolute,
7                size: taffy::geometry::Size {
8                    width: taffy::style::Dimension::Points(20f32),
9                    height: taffy::style::Dimension::Points(20f32),
10                    ..Default::default()
11                },
12                ..Default::default()
13            },
14            &[],
15        )
16        .unwrap();
17    let node = taffy
18        .new_with_children(
19            taffy::style::FlexboxLayout {
20                flex_direction: taffy::style::FlexDirection::Column,
21                flex_wrap: taffy::style::FlexWrap::WrapReverse,
22                size: taffy::geometry::Size {
23                    width: taffy::style::Dimension::Points(100f32),
24                    height: taffy::style::Dimension::Points(100f32),
25                    ..Default::default()
26                },
27                ..Default::default()
28            },
29            &[node0],
30        )
31        .unwrap();
32    taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap();
33}