⎇ 9e53f03adea2b770d68954e404d2fa407dfc7d40
benches/generated/margin_auto_mutiple_children_column.rs
Historia
Quién tocó qué
crudo
Layout algorithm decoupling, Sizing Constraints & Perf Improvements (#246)
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 {
7 width: taffy::style::Dimension::Points(50f32),
8 height: taffy::style::Dimension::Points(50f32),
9 ..Default::default()
10 },
11 margin: taffy::geometry::Rect { top: taffy::style::Dimension::Auto, ..Default::default() },
12 ..Default::default()
13 },
14 &[],
15 )
16 .unwrap();
17 let node1 = taffy
18 .new_with_children(
19 taffy::style::FlexboxLayout {
20 size: taffy::geometry::Size {
21 width: taffy::style::Dimension::Points(50f32),
22 height: taffy::style::Dimension::Points(50f32),
23 ..Default::default()
24 },
25 margin: taffy::geometry::Rect { top: taffy::style::Dimension::Auto, ..Default::default() },
26 ..Default::default()
27 },
28 &[],
29 )
30 .unwrap();
31 let node2 = taffy
32 .new_with_children(
33 taffy::style::FlexboxLayout {
34 size: taffy::geometry::Size {
35 width: taffy::style::Dimension::Points(50f32),
36 height: taffy::style::Dimension::Points(50f32),
37 ..Default::default()
38 },
39 ..Default::default()
40 },
41 &[],
42 )
43 .unwrap();
44 let node = taffy
45 .new_with_children(
46 taffy::style::FlexboxLayout {
47 flex_direction: taffy::style::FlexDirection::Column,
48 align_items: taffy::style::AlignItems::Center,
49 size: taffy::geometry::Size {
50 width: taffy::style::Dimension::Points(200f32),
51 height: taffy::style::Dimension::Points(200f32),
52 ..Default::default()
53 },
54 ..Default::default()
55 },
56 &[node0, node1, node2],
57 )
58 .unwrap();
59 taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap();
60}