tawasuyu

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 501HTML 254C 19JavaScript 81412 Sutichaykuna

⎇ ec371711989b7f4d870d91bea4b66bdd94b45c9e benches/generated/absolute_layout_start_top_end_bottom.rs Rust · 30 siq'ikuna · 1.1 KB Ñawpa willay Pi imata llamkarqan ch'uya

Rename PositionType and Position in accordance to specs (#295) e2cee9d6f · Andreas Weibye ·

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            inset: taffy::geometry::Rect {
9                left: taffy::style::LengthPercentageAuto::Points(10f32),
10                right: taffy::style::LengthPercentageAuto::Points(10f32),
11                top: taffy::style::LengthPercentageAuto::Points(10f32),
12                bottom: taffy::style::LengthPercentageAuto::Points(10f32),
13            },
14            ..Default::default()
15        })
16        .unwrap();
17    let node = taffy
18        .new_with_children(
19            taffy::style::Style {
20                size: taffy::geometry::Size {
21                    width: taffy::style::Dimension::Points(100f32),
22                    height: taffy::style::Dimension::Points(100f32),
23                },
24                ..Default::default()
25            },
26            &[node0],
27        )
28        .unwrap();
29    taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap();
30}