From 041cab0fa499a54d21d2742ba821583f55b2a8fc Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Mon, 8 Jun 2020 18:11:29 +0200 Subject: Resize `PaneGrid` without modifier keys --- native/src/widget/pane_grid/axis.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'native/src/widget/pane_grid/axis.rs') diff --git a/native/src/widget/pane_grid/axis.rs b/native/src/widget/pane_grid/axis.rs index b3a306d5..2320cb7c 100644 --- a/native/src/widget/pane_grid/axis.rs +++ b/native/src/widget/pane_grid/axis.rs @@ -53,6 +53,30 @@ impl Axis { } } } + + pub(super) fn split_line_bounds( + &self, + rectangle: Rectangle, + ratio: f32, + spacing: f32, + ) -> Rectangle { + match self { + Axis::Horizontal => Rectangle { + x: rectangle.x, + y: (rectangle.y + rectangle.height * ratio - spacing / 2.0) + .round(), + width: rectangle.width, + height: spacing, + }, + Axis::Vertical => Rectangle { + x: (rectangle.x + rectangle.width * ratio - spacing / 2.0) + .round(), + y: rectangle.y, + width: spacing, + height: rectangle.height, + }, + } + } } #[cfg(test)] -- cgit