diff options
author | 2023-12-15 10:02:13 +0000 | |
---|---|---|
committer | 2023-12-15 10:29:43 +0000 | |
commit | 116fb666b05d57df6f70631b11fc8732ed33f71b (patch) | |
tree | 1aadbbb5b760ceaf72d628e35520657955142118 /widget/src/pane_grid/state.rs | |
parent | dd249a1d11c68b8fee1828d58bae158946ee2ebd (diff) | |
download | iced-116fb666b05d57df6f70631b11fc8732ed33f71b.tar.gz iced-116fb666b05d57df6f70631b11fc8732ed33f71b.tar.bz2 iced-116fb666b05d57df6f70631b11fc8732ed33f71b.zip |
Add deadband distance before initiating drag action on pane grid
Diffstat (limited to 'widget/src/pane_grid/state.rs')
-rw-r--r-- | widget/src/pane_grid/state.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/widget/src/pane_grid/state.rs b/widget/src/pane_grid/state.rs index 481cd770..5d1fe254 100644 --- a/widget/src/pane_grid/state.rs +++ b/widget/src/pane_grid/state.rs @@ -403,6 +403,15 @@ pub enum Action { /// /// [`PaneGrid`]: super::PaneGrid Idle, + /// A [`Pane`] in the [`PaneGrid`] is being clicked. + /// + /// [`PaneGrid`]: super::PaneGrid + Clicking { + /// The [`Pane`] being clicked. + pane: Pane, + /// The starting [`Point`] of the click interaction. + origin: Point, + }, /// A [`Pane`] in the [`PaneGrid`] is being dragged. /// /// [`PaneGrid`]: super::PaneGrid @@ -432,6 +441,14 @@ impl Action { } } + /// Returns the current [`Pane`] that is being clicked, if any. + pub fn clicked_pane(&self) -> Option<(Pane, Point)> { + match *self { + Action::Clicking { pane, origin, .. } => Some((pane, origin)), + _ => None, + } + } + /// Returns the current [`Split`] that is being dragged, if any. pub fn picked_split(&self) -> Option<(Split, Axis)> { match *self { |