Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More pane grid fixes #1480

Merged
merged 4 commits into from
Oct 19, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions native/src/widget/pane_grid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,7 @@ where
cursor_position,
viewport,
renderer,
self.on_drag.is_some(),
)
})
.max()
Expand Down Expand Up @@ -648,7 +649,7 @@ pub fn mouse_interaction(
resize_leeway: Option<u16>,
) -> Option<mouse::Interaction> {
if action.picked_pane().is_some() {
return Some(mouse::Interaction::Grab);
return Some(mouse::Interaction::Grabbing);
}

let resize_axis =
Expand Down Expand Up @@ -756,7 +757,12 @@ pub fn draw<Renderer, T>(
cursor_position
};

for ((id, pane), layout) in elements.zip(layout.children()) {
// Render picked pane last
let mut elements = elements.zip(layout.children()).collect::<Vec<_>>();
elements
.sort_by_key(|((id, _), _)| picked_pane.map(|(id, _)| id) == Some(*id));
hecrj marked this conversation as resolved.
Show resolved Hide resolved

for ((id, pane), layout) in elements {
match picked_pane {
Some((dragging, origin)) if id == dragging => {
let bounds = layout.bounds();
Expand Down
3 changes: 2 additions & 1 deletion native/src/widget/pane_grid/content.rs
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ where
cursor_position: Point,
viewport: &Rectangle,
renderer: &Renderer,
drag_enabled: bool,
) -> mouse::Interaction {
let (body_layout, title_bar_interaction) =
if let Some(title_bar) = &self.title_bar {
Expand All @@ -247,7 +248,7 @@ where
let is_over_pick_area = title_bar
.is_over_pick_area(title_bar_layout, cursor_position);

if is_over_pick_area {
if is_over_pick_area && drag_enabled {
return mouse::Interaction::Grab;
}

Expand Down