Levitate cursor in scrollable

Fixes #3074
This commit is contained in:
Héctor Ramón Jiménez 2025-10-11 07:57:37 +02:00
parent 62795909d8
commit 01429d72cd
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
3 changed files with 36 additions and 37 deletions

View file

@ -363,7 +363,11 @@ where
Event::Mouse(mouse::Event::CursorMoved { .. })
| Event::Touch(touch::Event::FingerMoved { .. }) => {
if state.is_dragging {
let _ = cursor.position().and_then(locate).map(change);
let _ = cursor
.land()
.position()
.and_then(locate)
.map(change);
shell.capture_event();
}
@ -527,12 +531,10 @@ where
_renderer: &Renderer,
) -> mouse::Interaction {
let state = tree.state.downcast_ref::<State>();
let bounds = layout.bounds();
let is_mouse_over = cursor.is_over(bounds);
if state.is_dragging {
mouse::Interaction::Grabbing
} else if is_mouse_over {
} else if cursor.is_over(layout.bounds()) {
mouse::Interaction::Grab
} else {
mouse::Interaction::default()