summaryrefslogtreecommitdiffstats
path: root/native/src/widget/pane_grid
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-03-14 09:00:57 +0100
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-03-14 09:01:52 +0100
commitec334bdd362243a49237c1f07b601dd6b28ddc3a (patch)
treee8add80cc5e832cb2980d9677876293228f07898 /native/src/widget/pane_grid
parenteb5e2251bdb71c75e1da86b0f575cd0e13cafa6a (diff)
downloadiced-ec334bdd362243a49237c1f07b601dd6b28ddc3a.tar.gz
iced-ec334bdd362243a49237c1f07b601dd6b28ddc3a.tar.bz2
iced-ec334bdd362243a49237c1f07b601dd6b28ddc3a.zip
Improve pane selection when resizing a `PaneGrid`
Diffstat (limited to 'native/src/widget/pane_grid')
-rw-r--r--native/src/widget/pane_grid/axis.rs26
1 files changed, 13 insertions, 13 deletions
diff --git a/native/src/widget/pane_grid/axis.rs b/native/src/widget/pane_grid/axis.rs
index 375509b7..f8d53e09 100644
--- a/native/src/widget/pane_grid/axis.rs
+++ b/native/src/widget/pane_grid/axis.rs
@@ -15,36 +15,36 @@ 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;
+ let height_top =
+ (rectangle.height * ratio).round() - halved_spacing;
+ let height_bottom =
+ rectangle.height - height_top - halved_spacing;
(
Rectangle {
- width: width_left,
+ height: height_top,
..*rectangle
},
Rectangle {
- x: rectangle.x + width_left + halved_spacing,
- width: width_right,
+ y: rectangle.y + height_top + halved_spacing,
+ height: height_bottom,
..*rectangle
},
)
}
Axis::Vertical => {
- let height_top =
- (rectangle.height * ratio).round() - halved_spacing;
- let height_bottom =
- rectangle.height - height_top - halved_spacing;
+ let width_left =
+ (rectangle.width * ratio).round() - halved_spacing;
+ let width_right = rectangle.width - width_left - halved_spacing;
(
Rectangle {
- height: height_top,
+ width: width_left,
..*rectangle
},
Rectangle {
- y: rectangle.y + height_top + halved_spacing,
- height: height_bottom,
+ x: rectangle.x + width_left + halved_spacing,
+ width: width_right,
..*rectangle
},
)