Improve cursor style behavior for some draggable elements (#31965)

Follow-up to #24797

This PR ensures some cursor styles do not change for draggable elements
during dragging. The linked PR covered this on the higher level for
draggable divs. However, e.g. the pane divider inbetween two editors is
not a draggable div and thus still has the issue that the cursor style
changes during dragging. This PR fixes this issue by setting the hitbox
to `None` in cases where the element is currently being dragged, which
ensures the cursor style is applied to the cursor no matter what during
dragging.

Namely, this change fixes this for
- non-div pane dividers
- minimap slider and the
- editor scrollbars

and implements it for the UI scrollbars (Notably, UI scrollbars do
already have `cursor_default` on their parent container but would not
keep this during dragging. I opted out on removing this from the parent
containers until #30194 or a similar PR is merged).


https://github.com/user-attachments/assets/f97859dd-5f1d-4449-ab92-c27f2d933c4a

Release Notes:

- N/A
This commit is contained in:
Finn Evers 2025-06-06 22:56:27 +02:00 committed by GitHub
parent e0057ccd0f
commit 2fe1293fba
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 88 additions and 43 deletions

View file

@ -974,9 +974,9 @@ impl Element for TerminalElement {
&& bounds.contains(&window.mouse_position())
&& self.terminal_view.read(cx).hover.is_some()
{
window.set_cursor_style(gpui::CursorStyle::PointingHand, Some(&layout.hitbox));
window.set_cursor_style(gpui::CursorStyle::PointingHand, &layout.hitbox);
} else {
window.set_cursor_style(gpui::CursorStyle::IBeam, Some(&layout.hitbox));
window.set_cursor_style(gpui::CursorStyle::IBeam, &layout.hitbox);
}
let original_cursor = layout.cursor.take();