Fix implementation of Widget::mouse_interaction for PaneGrid
This commit is contained in:
parent
d165b789df
commit
77aa05afd3
1 changed files with 27 additions and 4 deletions
|
|
@ -481,10 +481,33 @@ where
|
||||||
return mouse::Interaction::Grab;
|
return mouse::Interaction::Grab;
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some((_, axis)) = self.state.picked_split() {
|
let resize_axis =
|
||||||
return match axis {
|
self.state.picked_split().map(|(_, axis)| axis).or_else(|| {
|
||||||
Axis::Horizontal => mouse::Interaction::ResizingHorizontally,
|
self.on_resize.as_ref().and_then(|(leeway, _)| {
|
||||||
Axis::Vertical => mouse::Interaction::ResizingVertically,
|
let bounds = layout.bounds();
|
||||||
|
|
||||||
|
let splits = self
|
||||||
|
.state
|
||||||
|
.split_regions(f32::from(self.spacing), bounds.size());
|
||||||
|
|
||||||
|
let relative_cursor = Point::new(
|
||||||
|
cursor_position.x - bounds.x,
|
||||||
|
cursor_position.y - bounds.y,
|
||||||
|
);
|
||||||
|
|
||||||
|
hovered_split(
|
||||||
|
splits.iter(),
|
||||||
|
f32::from(self.spacing + leeway),
|
||||||
|
relative_cursor,
|
||||||
|
)
|
||||||
|
.map(|(_, axis, _)| axis)
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
if let Some(resize_axis) = resize_axis {
|
||||||
|
return match resize_axis {
|
||||||
|
Axis::Horizontal => mouse::Interaction::ResizingVertically,
|
||||||
|
Axis::Vertical => mouse::Interaction::ResizingHorizontally,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue