⎇ 9e53f03adea2b770d68954e404d2fa407dfc7d40
benches/generated/gap_row_gap_column_child_margins.rs
Historia
Quién tocó qué
crudo
Implement "gap" property for flexbox algorithm (#248)
1pub fn compute() {
2 let mut taffy = taffy::Taffy::new();
3 let node0 = taffy
4 .new_with_children(
5 taffy::style::FlexboxLayout {
6 flex_grow: 1f32,
7 flex_shrink: 1f32,
8 flex_basis: taffy::style::Dimension::Percent(0f32),
9 margin: taffy::geometry::Rect {
10 top: taffy::style::Dimension::Points(2f32),
11 bottom: taffy::style::Dimension::Points(2f32),
12 ..Default::default()
13 },
14 ..Default::default()
15 },
16 &[],
17 )
18 .unwrap();
19 let node1 = taffy
20 .new_with_children(
21 taffy::style::FlexboxLayout {
22 flex_grow: 1f32,
23 flex_shrink: 1f32,
24 flex_basis: taffy::style::Dimension::Percent(0f32),
25 margin: taffy::geometry::Rect {
26 top: taffy::style::Dimension::Points(10f32),
27 bottom: taffy::style::Dimension::Points(10f32),
28 ..Default::default()
29 },
30 ..Default::default()
31 },
32 &[],
33 )
34 .unwrap();
35 let node2 = taffy
36 .new_with_children(
37 taffy::style::FlexboxLayout {
38 flex_grow: 1f32,
39 flex_shrink: 1f32,
40 flex_basis: taffy::style::Dimension::Percent(0f32),
41 margin: taffy::geometry::Rect {
42 top: taffy::style::Dimension::Points(15f32),
43 bottom: taffy::style::Dimension::Points(15f32),
44 ..Default::default()
45 },
46 ..Default::default()
47 },
48 &[],
49 )
50 .unwrap();
51 let node = taffy
52 .new_with_children(
53 taffy::style::FlexboxLayout {
54 flex_direction: taffy::style::FlexDirection::Column,
55 gap: taffy::geometry::Size { height: taffy::style::Dimension::Points(10f32), ..Default::default() },
56 size: taffy::geometry::Size {
57 width: taffy::style::Dimension::Points(100f32),
58 height: taffy::style::Dimension::Points(200f32),
59 ..Default::default()
60 },
61 ..Default::default()
62 },
63 &[node0, node1, node2],
64 )
65 .unwrap();
66 taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap();
67}