diff options
-rw-r--r-- | native/src/widget/pane_grid.rs | 31 | ||||
-rw-r--r-- | src/settings.rs | 2 | ||||
-rw-r--r-- | winit/src/application.rs | 2 |
3 files changed, 30 insertions, 5 deletions
diff --git a/native/src/widget/pane_grid.rs b/native/src/widget/pane_grid.rs index 20616ed4..3637822b 100644 --- a/native/src/widget/pane_grid.rs +++ b/native/src/widget/pane_grid.rs @@ -481,10 +481,33 @@ where return mouse::Interaction::Grab; } - if let Some((_, axis)) = self.state.picked_split() { - return match axis { - Axis::Horizontal => mouse::Interaction::ResizingHorizontally, - Axis::Vertical => mouse::Interaction::ResizingVertically, + let resize_axis = + self.state.picked_split().map(|(_, axis)| axis).or_else(|| { + self.on_resize.as_ref().and_then(|(leeway, _)| { + let bounds = layout.bounds(); + + let splits = self + .state + .split_regions(f32::from(self.spacing), bounds.size()); + + let relative_cursor = Point::new( + cursor_position.x - bounds.x, + cursor_position.y - bounds.y, + ); + + hovered_split( + splits.iter(), + f32::from(self.spacing + leeway), + relative_cursor, + ) + .map(|(_, axis, _)| axis) + }) + }); + + if let Some(resize_axis) = resize_axis { + return match resize_axis { + Axis::Horizontal => mouse::Interaction::ResizingVertically, + Axis::Vertical => mouse::Interaction::ResizingHorizontally, }; } diff --git a/src/settings.rs b/src/settings.rs index d726dc4f..f7940a0b 100644 --- a/src/settings.rs +++ b/src/settings.rs @@ -52,6 +52,8 @@ pub struct Settings<Flags> { /// window to close (e.g. the user presses the close button). /// /// By default, it is enabled. + /// + /// [`Application`]: crate::Application pub exit_on_close_request: bool, } diff --git a/winit/src/application.rs b/winit/src/application.rs index 9d787933..9ae1364d 100644 --- a/winit/src/application.rs +++ b/winit/src/application.rs @@ -22,7 +22,7 @@ use std::mem::ManuallyDrop; /// An interactive, native cross-platform application. /// /// This trait is the main entrypoint of Iced. Once implemented, you can run -/// your GUI application by simply calling [`run`](#method.run). It will run in +/// your GUI application by simply calling [`run`]. It will run in /// its own window. /// /// An [`Application`] can execute asynchronous actions by returning a |