Skip to content

Commit 3e1a942

Browse files
authored
Merge pull request #3 from wechat-miniprogram/refactor-special-position
refactor: special position layout
2 parents 24a66e2 + c9ee263 commit 3e1a942

File tree

4 files changed

+360
-522
lines changed

4 files changed

+360
-522
lines changed

float-pigment-layout/src/algo/flex_box.rs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1303,9 +1303,11 @@ impl<T: LayoutTreeNode> FlexBox<T> for LayoutUnit<T> {
13031303
}
13041304
};
13051305
let baseline_diff = child.gen_origin(
1306-
dir,
1307-
main_dir_rev,
1308-
cross_dir_rev,
1306+
AxisInfo {
1307+
main_dir_rev,
1308+
cross_dir_rev,
1309+
dir,
1310+
},
13091311
*container_size,
13101312
offset_main,
13111313
offset_cross,
@@ -1344,9 +1346,11 @@ impl<T: LayoutTreeNode> FlexBox<T> for LayoutUnit<T> {
13441346
&ret,
13451347
border,
13461348
padding_border,
1347-
dir,
1348-
main_dir_rev,
1349-
AxisReverse::NotReversed,
1349+
AxisInfo {
1350+
dir,
1351+
main_dir_rev,
1352+
cross_dir_rev: AxisReverse::NotReversed,
1353+
},
13501354
true,
13511355
);
13521356
self.result = Rect::new(Point::zero(), ret.size.0);

float-pigment-layout/src/algo/flow.rs

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -297,9 +297,10 @@ impl<T: LayoutTreeNode> Flow<T> for LayoutUnit<T> {
297297
&ret,
298298
border,
299299
padding_border,
300-
axis_info.dir,
301-
axis_info.main_dir_rev,
302-
AxisReverse::NotReversed,
300+
AxisInfo {
301+
cross_dir_rev: AxisReverse::NotReversed,
302+
..axis_info
303+
},
303304
false,
304305
);
305306
self.result = Rect::new(Point::zero(), ret.size.0);
@@ -491,9 +492,10 @@ impl<T: LayoutTreeNode> Flow<T> for LayoutUnit<T> {
491492
.or_zero()
492493
};
493494
let baseline_diff = child.gen_origin(
494-
axis_info.dir,
495-
axis_info.main_dir_rev,
496-
AxisReverse::NotReversed,
495+
AxisInfo {
496+
cross_dir_rev: AxisReverse::NotReversed,
497+
..axis_info
498+
},
497499
node_inner_size.or_zero(),
498500
main_offset,
499501
cross_offset,
@@ -616,9 +618,10 @@ impl<T: LayoutTreeNode> Flow<T> for LayoutUnit<T> {
616618
child.result = Rect::new(Point::zero(), child_res.size);
617619
child.cache.touch(child_node);
618620
child.gen_origin(
619-
axis_info.dir,
620-
axis_info.main_dir_rev,
621-
AxisReverse::NotReversed,
621+
AxisInfo {
622+
cross_dir_rev: AxisReverse::NotReversed,
623+
..axis_info
624+
},
622625
node_inner_size.or_zero(),
623626
main_offset + child_origin.main_axis(axis_info.dir),
624627
cross_offset + child_origin.cross_axis(axis_info.dir),
@@ -671,9 +674,7 @@ impl<T: LayoutTreeNode> Flow<T> for LayoutUnit<T> {
671674
},
672675
border,
673676
padding_border,
674-
axis_info.dir,
675-
axis_info.main_dir_rev,
676-
axis_info.cross_dir_rev,
677+
axis_info,
677678
false,
678679
)
679680
}

0 commit comments

Comments
 (0)