FIX - RelativeCursorPosition Changed<> query filter (#20102)

## Problem

This pseudocode was triggering constantly, even with the Changed<> query
filter.

```rust
pub fn check_mouse_movement_system(
    relative_cursor_positions: Query< &RelativeCursorPosition, (Changed<RelativeCursorPosition>, With<Button>)>,
) {}
```

## Solution

- Added a check to prevent updating the value if it hasn't changed.

---------

Co-authored-by: Giacomo Stevanato <giaco.stevanato@gmail.com>
This commit is contained in:
Chamaloriz 2025-07-13 19:44:40 +00:00 committed by GitHub
parent 84936cad55
commit d83bae4417
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -267,7 +267,9 @@ pub fn ui_focus_system(
// Save the relative cursor position to the correct component
if let Some(mut node_relative_cursor_position_component) = node.relative_cursor_position
{
*node_relative_cursor_position_component = relative_cursor_position_component;
// Avoid triggering change detection when not necessary.
node_relative_cursor_position_component
.set_if_neq(relative_cursor_position_component);
}
if contains_cursor {