Improve pane selection when resizing a PaneGrid
This commit is contained in:
parent
eb5e2251bd
commit
ec334bdd36
3 changed files with 71 additions and 69 deletions
|
|
@ -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
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue