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:
parent
84936cad55
commit
d83bae4417
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user