Check cursor is in-bounds before resizing panes
This commit is contained in:
parent
31aaf207d6
commit
33f33ed4e3
@ -467,6 +467,8 @@ where
|
||||
&& self.pressed_modifiers.matches(self.modifier_keys) =>
|
||||
{
|
||||
let bounds = layout.bounds();
|
||||
|
||||
if bounds.contains(cursor_position) {
|
||||
let relative_cursor = Point::new(
|
||||
cursor_position.x - bounds.x,
|
||||
cursor_position.y - bounds.y,
|
||||
@ -493,7 +495,8 @@ where
|
||||
})
|
||||
.collect();
|
||||
|
||||
sorted_splits.sort_by_key(|(_, (axis, rectangle, ratio))| {
|
||||
sorted_splits.sort_by_key(
|
||||
|(_, (axis, rectangle, ratio))| {
|
||||
let distance = match axis {
|
||||
Axis::Horizontal => (relative_cursor.y
|
||||
- (rectangle.y + rectangle.height * ratio))
|
||||
@ -504,13 +507,15 @@ where
|
||||
};
|
||||
|
||||
distance.round() as u32
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
if let Some((split, (axis, _, _))) = sorted_splits.first() {
|
||||
self.state.pick_split(split, *axis);
|
||||
self.trigger_resize(layout, cursor_position, messages);
|
||||
}
|
||||
}
|
||||
}
|
||||
Event::Mouse(mouse::Event::Input {
|
||||
button: mouse::Button::Right,
|
||||
state: ButtonState::Released,
|
||||
|
Loading…
Reference in New Issue
Block a user