From 21a4095a99e23d7302cb689c73970c886b0278b8 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Tue, 17 Mar 2020 04:15:17 +0100 Subject: Fix spacing calculation in `Axis::split` --- native/src/widget/pane_grid/axis.rs | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'native') 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 }, ) -- cgit