tawasuyu

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 717HTML 669Markdown 12TOML 62372 Definiciones

⎇ b0c7d824daea2c453850812d532c277f8ac37736 benches/generated/justify_content_colunn_max_height_and_margin.rs Rust · 34 líneas · 1.4 KB Historia Quién tocó qué crudo

Fix justify content with margin tests (#329) b0c7d824d · Nico Burns ·

1pub fn compute() {
2    #[allow(unused_imports)]
3    use taffy::prelude::*;
4    let mut taffy = taffy::Taffy::new();
5    let node00 = taffy
6        .new_leaf(taffy::style::Style {
7            size: taffy::geometry::Size {
8                width: taffy::style::Dimension::Points(20f32),
9                height: taffy::style::Dimension::Points(20f32),
10            },
11            ..Default::default()
12        })
13        .unwrap();
14    let node0 = taffy
15        .new_with_children(
16            taffy::style::Style {
17                flex_direction: taffy::style::FlexDirection::Column,
18                justify_content: Some(taffy::style::JustifyContent::Center),
19                size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Points(100f32) },
20                max_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Points(80f32) },
21                margin: taffy::geometry::Rect {
22                    left: zero(),
23                    right: zero(),
24                    top: taffy::style::LengthPercentageAuto::Points(100f32),
25                    bottom: zero(),
26                },
27                ..Default::default()
28            },
29            &[node00],
30        )
31        .unwrap();
32    let node = taffy.new_with_children(taffy::style::Style { ..Default::default() }, &[node0]).unwrap();
33    taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap();
34}