Fix clicked UI nodes getting reset when hovering child nodes (#4194)

# Objective

Fixes #4193

## Solution

When resetting a node's `Interaction` to `None`, ignore any `Clicked` node because that should be handled by the mouse release check exclusively.
This commit is contained in:
Gabriel Bourgeois 2022-04-07 19:08:09 +00:00
parent 21a875d67b
commit 6f16580b8a

View file

@ -169,7 +169,8 @@ pub fn ui_focus_system(
// reset lower nodes to None
for (_entity, _focus_policy, interaction, _) in moused_over_z_sorted_nodes {
if let Some(mut interaction) = interaction {
if *interaction != Interaction::None {
// don't reset clicked nodes because they're handled separately
if *interaction != Interaction::Clicked && *interaction != Interaction::None {
*interaction = Interaction::None;
}
}