diff options
author | 2024-10-29 15:55:47 +0100 | |
---|---|---|
committer | 2024-11-05 23:52:58 +0100 | |
commit | 4e47450c336a235fe26090665aca1cc7b4d23384 (patch) | |
tree | 25c22890b86fb3765a69ad59d015ced508e0611e /widget/src/pane_grid/content.rs | |
parent | 920596ed6f44acf8d87d2135c1b8967bab23d5b9 (diff) | |
download | iced-4e47450c336a235fe26090665aca1cc7b4d23384.tar.gz iced-4e47450c336a235fe26090665aca1cc7b4d23384.tar.bz2 iced-4e47450c336a235fe26090665aca1cc7b4d23384.zip |
Implement `reactive-rendering` for `pane_grid`
Diffstat (limited to 'widget/src/pane_grid/content.rs')
-rw-r--r-- | widget/src/pane_grid/content.rs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/widget/src/pane_grid/content.rs b/widget/src/pane_grid/content.rs index e0199f0a..f1f67023 100644 --- a/widget/src/pane_grid/content.rs +++ b/widget/src/pane_grid/content.rs @@ -284,6 +284,31 @@ where } } + pub(crate) fn grid_interaction( + &self, + layout: Layout<'_>, + cursor: mouse::Cursor, + drag_enabled: bool, + ) -> Option<mouse::Interaction> { + let title_bar = self.title_bar.as_ref()?; + + let mut children = layout.children(); + let title_bar_layout = children.next().unwrap(); + + let is_over_pick_area = cursor + .position() + .map(|cursor_position| { + title_bar.is_over_pick_area(title_bar_layout, cursor_position) + }) + .unwrap_or_default(); + + if is_over_pick_area && drag_enabled { + return Some(mouse::Interaction::Grab); + } + + None + } + pub(crate) fn mouse_interaction( &self, tree: &Tree, |