diff options
author | 2020-07-22 03:40:17 +0200 | |
---|---|---|
committer | 2020-07-22 03:40:17 +0200 | |
commit | 3d91926a74ab213b2a6a61732adcc5c561748f78 (patch) | |
tree | 0ad6aaea327f38703947a9bc0f6d4724d521f0f5 /native | |
parent | 35b1b8b0e72bd57ddc793624c6c26c1f0c3eb9e1 (diff) | |
download | iced-3d91926a74ab213b2a6a61732adcc5c561748f78.tar.gz iced-3d91926a74ab213b2a6a61732adcc5c561748f78.tar.bz2 iced-3d91926a74ab213b2a6a61732adcc5c561748f78.zip |
Keep original focus state while a pane is dragged
Diffstat (limited to 'native')
-rw-r--r-- | native/src/widget/pane_grid/state.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/native/src/widget/pane_grid/state.rs b/native/src/widget/pane_grid/state.rs index f537c7de..fb59c846 100644 --- a/native/src/widget/pane_grid/state.rs +++ b/native/src/widget/pane_grid/state.rs @@ -335,6 +335,7 @@ pub enum Action { Dragging { pane: Pane, origin: Point, + focus: Option<Pane>, }, Resizing { split: Split, @@ -362,7 +363,7 @@ impl Internal { pub fn focused_pane(&self) -> Option<Pane> { match self.action { Action::Idle { focus } => focus, - Action::Dragging { pane, .. } => Some(pane), + Action::Dragging { focus, .. } => focus, Action::Resizing { focus, .. } => focus, } } @@ -376,7 +377,7 @@ impl Internal { pub fn picked_pane(&self) -> Option<(Pane, Point)> { match self.action { - Action::Dragging { pane, origin } => Some((pane, origin)), + Action::Dragging { pane, origin, .. } => Some((pane, origin)), _ => None, } } @@ -409,9 +410,12 @@ impl Internal { } pub fn pick_pane(&mut self, pane: &Pane, origin: Point) { + let focus = self.focused_pane(); + self.action = Action::Dragging { pane: *pane, origin, + focus, }; } |