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

@ -762,7 +762,7 @@ where
),
)
}
_ => mouse::Cursor::Unavailable,
_ => cursor.levitate(),
};
let had_input_method = shell.input_method().is_enabled();
@ -1178,35 +1178,33 @@ where
let (mouse_over_y_scrollbar, mouse_over_x_scrollbar) =
scrollbars.is_mouse_over(cursor);
if (mouse_over_x_scrollbar || mouse_over_y_scrollbar)
|| state.scrollers_grabbed()
{
mouse::Interaction::None
} else {
let translation =
state.translation(self.direction, bounds, content_bounds);
let cursor = match cursor_over_scrollable {
Some(cursor_position)
if !(mouse_over_x_scrollbar || mouse_over_y_scrollbar) =>
{
mouse::Cursor::Available(cursor_position + translation)
}
_ => mouse::Cursor::Unavailable,
};
self.content.as_widget().mouse_interaction(
&tree.children[0],
content_layout,
cursor,
&Rectangle {
y: bounds.y + translation.y,
x: bounds.x + translation.x,
..bounds
},
renderer,
)
if state.scrollers_grabbed() {
return mouse::Interaction::None;
}
let translation =
state.translation(self.direction, bounds, content_bounds);
let cursor = match cursor_over_scrollable {
Some(cursor_position)
if !(mouse_over_x_scrollbar || mouse_over_y_scrollbar) =>
{
mouse::Cursor::Available(cursor_position + translation)
}
_ => cursor.levitate(),
};
self.content.as_widget().mouse_interaction(
&tree.children[0],
content_layout,
cursor,
&Rectangle {
y: bounds.y + translation.y,
x: bounds.x + translation.x,
..bounds
},
renderer,
)
}
fn overlay<'b>(