Improve pane selection when resizing a PaneGrid

This commit is contained in:
Héctor Ramón Jiménez 2020-03-14 09:00:57 +01:00
parent eb5e2251bd
commit ec334bdd36
3 changed files with 71 additions and 69 deletions

View file

@ -15,23 +15,6 @@ impl Axis {
) -> (Rectangle, Rectangle) {
match self {
Axis::Horizontal => {
let width_left =
(rectangle.width * ratio).round() - halved_spacing;
let width_right = rectangle.width - width_left - halved_spacing;
(
Rectangle {
width: width_left,
..*rectangle
},
Rectangle {
x: rectangle.x + width_left + halved_spacing,
width: width_right,
..*rectangle
},
)
}
Axis::Vertical => {
let height_top =
(rectangle.height * ratio).round() - halved_spacing;
let height_bottom =
@ -49,6 +32,23 @@ impl Axis {
},
)
}
Axis::Vertical => {
let width_left =
(rectangle.width * ratio).round() - halved_spacing;
let width_right = rectangle.width - width_left - halved_spacing;
(
Rectangle {
width: width_left,
..*rectangle
},
Rectangle {
x: rectangle.x + width_left + halved_spacing,
width: width_right,
..*rectangle
},
)
}
}
}
}