fix(grid): enables flip_layout and make it behave correctly

This commit is contained in:
Javier Portillo
2024-02-24 23:05:47 -06:00
committed by جاد
parent 98244b9572
commit eab7a64250
2 changed files with 19 additions and 8 deletions
+19 -3
View File
@@ -156,11 +156,27 @@ impl Arrangement for DefaultLayout {
for row in 0..num_rows_in_this_col {
if let Some((_idx, win)) = iter.next() {
let mut left = area.left + win_width * col;
let mut top = area.top + win_height * row;
match layout_flip {
Some(Axis::Horizontal) => {
left = area.right - win_width * (col + 1) + area.left;
}
Some(Axis::Vertical) => {
top = area.bottom - win_height * (row + 1) + area.top;
}
Some(Axis::HorizontalAndVertical) => {
left = area.right - win_width * (col + 1) + area.left;
top = area.bottom - win_height * (row + 1) + area.top;
}
None => {} // No flip
}
win.bottom = win_height;
win.right = win_width;
win.left = area.left + win_width * col;
win.top = area.top + win_height * row;
win.left = left;
win.top = top;
}
}
}