Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions core/src/player.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1745,6 +1745,30 @@ impl Player {
if !skip_mouse_hover && !new_over_object_updated {
context.mouse_data.hovered = new_over_object;
}

// Even when hover events are skipped (mouse did not move), update the cursor
// if the object under the mouse changed, e.g. an animated object walked
// under a stationary cursor.
if skip_mouse_hover
&& !InteractiveObject::option_ptr_eq(cur_over_object, new_over_object)
{
context.mouse_data.hovered = new_over_object;
new_cursor = match new_over_object {
Some(obj) => obj.mouse_cursor(context),
None => MouseCursor::Arrow,
};
}

// When the mouse moves within the same object, re-evaluate the cursor,
// since different parts of an object may use different cursors (e.g. links inside a text field).
if is_mouse_moved && InteractiveObject::option_ptr_eq(cur_over_object, new_over_object)
{
new_cursor = match new_over_object {
Some(obj) => obj.mouse_cursor(context),
None => MouseCursor::Arrow,
};
}

// Handle presses and releases.
for button in [MouseButton::Left, MouseButton::Middle, MouseButton::Right] {
if !changed_mouse_buttons.contains(button) {
Expand Down
Loading