Implement reactive-rendering for pane_grid

This commit is contained in:
Héctor Ramón Jiménez 2024-10-29 15:55:47 +01:00
parent 920596ed6f
commit 4e47450c33
No known key found for this signature in database
GPG key ID: 4C07CEC81AFA161F
2 changed files with 105 additions and 35 deletions

View file

@ -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,