⎇ b91874d4e34ecc9054b468a338ffcae6f61a1b4a
benches/generated/percent_absolute_position.rs
Historia
Quién tocó qué
crudo
Rename PositionType and Position in accordance to specs (#295)
1pub fn compute() {
2 #[allow(unused_imports)]
3 use taffy::prelude::*;
4 let mut taffy = taffy::Taffy::new();
5 let node00 = taffy
6 .new_leaf(taffy::style::Style {
7 size: taffy::geometry::Size { width: taffy::style::Dimension::Percent(1f32), height: auto() },
8 ..Default::default()
9 })
10 .unwrap();
11 let node01 = taffy
12 .new_leaf(taffy::style::Style {
13 size: taffy::geometry::Size { width: taffy::style::Dimension::Percent(1f32), height: auto() },
14 ..Default::default()
15 })
16 .unwrap();
17 let node0 = taffy
18 .new_with_children(
19 taffy::style::Style {
20 position: taffy::style::Position::Absolute,
21 size: taffy::geometry::Size {
22 width: taffy::style::Dimension::Percent(1f32),
23 height: taffy::style::Dimension::Points(50f32),
24 },
25 inset: taffy::geometry::Rect {
26 left: taffy::style::LengthPercentageAuto::Percent(0.5f32),
27 right: auto(),
28 top: auto(),
29 bottom: auto(),
30 },
31 ..Default::default()
32 },
33 &[node00, node01],
34 )
35 .unwrap();
36 let node = taffy
37 .new_with_children(
38 taffy::style::Style {
39 flex_direction: taffy::style::FlexDirection::Column,
40 size: taffy::geometry::Size {
41 width: taffy::style::Dimension::Points(60f32),
42 height: taffy::style::Dimension::Points(50f32),
43 },
44 ..Default::default()
45 },
46 &[node0],
47 )
48 .unwrap();
49 taffy.compute_layout(node, taffy::geometry::Size::MAX_CONTENT).unwrap();
50}