mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-07 17:26:56 +00:00
Correctly re-render mouse cursor when hovering over pane group divider (#9270)
Before this change, the hitbox felt one-sided because the cursor didn't consistently change into the drag-handle cursor. The reason was that we didn't trigger a redraw on hover, so we'd only change the cursor if we detected hover AND something else caused a redraw. Release Notes: - Fixed the pane resize handler not consistently triggering on mouse hover. Co-authored-by: Antonio <antonio@zed.dev>
This commit is contained in:
parent
754df9356d
commit
ac4bbb6135
1 changed files with 17 additions and 11 deletions
|
@ -941,19 +941,25 @@ mod element {
|
|||
let flexes = self.flexes.clone();
|
||||
let child_bounds = child.bounds;
|
||||
let axis = self.axis;
|
||||
let handle_hitbox = handle.hitbox.clone();
|
||||
let was_hovered = handle_hitbox.is_hovered(cx);
|
||||
move |e: &MouseMoveEvent, phase, cx| {
|
||||
let dragged_handle = dragged_handle.borrow();
|
||||
if phase.bubble() && *dragged_handle == Some(ix) {
|
||||
Self::compute_resize(
|
||||
&flexes,
|
||||
e,
|
||||
ix,
|
||||
axis,
|
||||
child_bounds.origin,
|
||||
bounds.size,
|
||||
workspace.clone(),
|
||||
cx,
|
||||
)
|
||||
if phase.bubble() {
|
||||
if *dragged_handle == Some(ix) {
|
||||
Self::compute_resize(
|
||||
&flexes,
|
||||
e,
|
||||
ix,
|
||||
axis,
|
||||
child_bounds.origin,
|
||||
bounds.size,
|
||||
workspace.clone(),
|
||||
cx,
|
||||
)
|
||||
} else if was_hovered != handle_hitbox.is_hovered(cx) {
|
||||
cx.refresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue