Skip to content

Commit

Permalink
Fix pane grid mouse interactions
Browse files Browse the repository at this point in the history
- Use `grabbing` interaction while dragging
- Ignore grab interaction when dragging is disabled
  • Loading branch information
tarkah committed Oct 17, 2022
1 parent 69e288c commit dca99f3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion 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
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

0 comments on commit dca99f3

Please sign in to comment.