diff options
author | 2024-01-04 05:26:12 +0100 | |
---|---|---|
committer | 2024-01-04 05:26:12 +0100 | |
commit | 68c0484b5cf6f572e4cb0bf72c22c1a93dbb654e (patch) | |
tree | fe0a3e26607433897e8b2d3512d4f4787bb24599 /widget/src/pane_grid | |
parent | 0172cac9493c470f46789ae096d349e36459eb0d (diff) | |
parent | 116fb666b05d57df6f70631b11fc8732ed33f71b (diff) | |
download | iced-68c0484b5cf6f572e4cb0bf72c22c1a93dbb654e.tar.gz iced-68c0484b5cf6f572e4cb0bf72c22c1a93dbb654e.tar.bz2 iced-68c0484b5cf6f572e4cb0bf72c22c1a93dbb654e.zip |
Merge pull request #2168 from jhff/fix/pane_grid_top_edge_click
[Fix] `PaneGrid` click interaction on the top edge
Diffstat (limited to 'widget/src/pane_grid')
-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 { |