tawasuyu

tawasuyu/taffy

A high performance rust-powered UI layout library

HTML 231Rust 9TOML 3CSS 1345 Definiciones

⎇ b91874d4e34ecc9054b468a338ffcae6f61a1b4a benches/generated/absolute_minmax_bottom_right_min_max.rs Rust · 38 líneas · 1.4 KB Historia Quién tocó qué crudo

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            position: taffy::style::Position::Absolute,
8            min_size: taffy::geometry::Size {
9                width: taffy::style::Dimension::Points(50f32),
10                height: taffy::style::Dimension::Points(60f32),
11            },
12            max_size: taffy::geometry::Size {
13                width: taffy::style::Dimension::Points(40f32),
14                height: taffy::style::Dimension::Points(30f32),
15            },
16            inset: taffy::geometry::Rect {
17                left: auto(),
18                right: taffy::style::LengthPercentageAuto::Points(10f32),
19                top: auto(),
20                bottom: taffy::style::LengthPercentageAuto::Points(10f32),
21            },
22            ..Default::default()
23        })
24        .unwrap();
25    let node = taffy
26        .new_with_children(
27            taffy::style::Style {
28                size: taffy::geometry::Size {
29                    width: taffy::style::Dimension::Points(100f32),
30                    height: taffy::style::Dimension::Points(100f32),
31                },
32                ..Default::default()
33            },
34            &[node0],
35        )
36        .unwrap();
37    taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap();
38}