gioser

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 684HTML 640Markdown 12TOML 62286 Definiciones

⎇ 9e53f03adea2b770d68954e404d2fa407dfc7d40 benches/generated/gap_column_gap_inflexible_undefined_parent.rs Rust · 41 líneas · 1.5 KB Historia Quién tocó qué crudo

Implement "gap" property for flexbox algorithm (#248) 9e53f03ad · 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                size: taffy::geometry::Size { width: taffy::style::Dimension::Points(20f32), ..Default::default() },
7                ..Default::default()
8            },
9            &[],
10        )
11        .unwrap();
12    let node1 = taffy
13        .new_with_children(
14            taffy::style::FlexboxLayout {
15                size: taffy::geometry::Size { width: taffy::style::Dimension::Points(20f32), ..Default::default() },
16                ..Default::default()
17            },
18            &[],
19        )
20        .unwrap();
21    let node2 = taffy
22        .new_with_children(
23            taffy::style::FlexboxLayout {
24                size: taffy::geometry::Size { width: taffy::style::Dimension::Points(20f32), ..Default::default() },
25                ..Default::default()
26            },
27            &[],
28        )
29        .unwrap();
30    let node = taffy
31        .new_with_children(
32            taffy::style::FlexboxLayout {
33                gap: taffy::geometry::Size { width: taffy::style::Dimension::Points(10f32), ..Default::default() },
34                size: taffy::geometry::Size { height: taffy::style::Dimension::Points(100f32), ..Default::default() },
35                ..Default::default()
36            },
37            &[node0, node1, node2],
38        )
39        .unwrap();
40    taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap();
41}