gioser

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 684HTML 640Markdown 12TOML 62290 Definiciones

⎇ b91874d4e34ecc9054b468a338ffcae6f61a1b4a benches/generated/justify_content_column_min_height_and_margin_bottom.rs Rust · 32 líneas · 1.1 KB Historia Quién tocó qué crudo

Implement CSS Grid (#205) 6fd2c6bcb · 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 {
8                width: taffy::style::Dimension::Points(20f32),
9                height: taffy::style::Dimension::Points(20f32),
10            },
11            margin: taffy::geometry::Rect {
12                left: zero(),
13                right: zero(),
14                top: zero(),
15                bottom: taffy::style::LengthPercentageAuto::Points(10f32),
16            },
17            ..Default::default()
18        })
19        .unwrap();
20    let node = taffy
21        .new_with_children(
22            taffy::style::Style {
23                flex_direction: taffy::style::FlexDirection::Column,
24                justify_content: Some(taffy::style::JustifyContent::Center),
25                min_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::Points(50f32) },
26                ..Default::default()
27            },
28            &[node0],
29        )
30        .unwrap();
31    taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap();
32}