diff options
author | 2020-03-17 04:15:17 +0100 | |
---|---|---|
committer | 2020-03-17 04:15:17 +0100 | |
commit | 21a4095a99e23d7302cb689c73970c886b0278b8 (patch) | |
tree | 331d58688b8b7dad692e1caf4c8abb25bcd25d90 | |
parent | c7583f12270082dc2f4d766aea50be7bd49b6c50 (diff) | |
download | iced-21a4095a99e23d7302cb689c73970c886b0278b8.tar.gz iced-21a4095a99e23d7302cb689c73970c886b0278b8.tar.bz2 iced-21a4095a99e23d7302cb689c73970c886b0278b8.zip |
Fix spacing calculation in `Axis::split`
-rw-r--r-- | native/src/widget/pane_grid/axis.rs | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/native/src/widget/pane_grid/axis.rs b/native/src/widget/pane_grid/axis.rs index f8d53e09..a17d0c12 100644 --- a/native/src/widget/pane_grid/axis.rs +++ b/native/src/widget/pane_grid/axis.rs @@ -15,36 +15,33 @@ impl Axis { ) -> (Rectangle, Rectangle) { match self { Axis::Horizontal => { - let height_top = - (rectangle.height * ratio).round() - halved_spacing; - let height_bottom = - rectangle.height - height_top - halved_spacing; + let height_top = (rectangle.height * ratio).round(); + let height_bottom = rectangle.height - height_top; ( Rectangle { - height: height_top, + height: height_top - halved_spacing, ..*rectangle }, Rectangle { y: rectangle.y + height_top + halved_spacing, - height: height_bottom, + height: height_bottom - halved_spacing, ..*rectangle }, ) } Axis::Vertical => { - let width_left = - (rectangle.width * ratio).round() - halved_spacing; - let width_right = rectangle.width - width_left - halved_spacing; + let width_left = (rectangle.width * ratio).round(); + let width_right = rectangle.width - width_left; ( Rectangle { - width: width_left, + width: width_left - halved_spacing, ..*rectangle }, Rectangle { x: rectangle.x + width_left + halved_spacing, - width: width_right, + width: width_right - halved_spacing, ..*rectangle }, ) |