Skip to content

Commit

Permalink
Fix clicked UI nodes getting reset when hovering child nodes (#4194)
Browse files Browse the repository at this point in the history
# 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.
  • Loading branch information
oceantume committed Apr 7, 2022
1 parent 21a875d commit 6f16580
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion crates/bevy_ui/src/focus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down

0 comments on commit 6f16580

Please sign in to comment.