Skip to content

Commit

Permalink
Fix clicked UI nodes getting reset when hovering child nodes (bevyeng…
Browse files Browse the repository at this point in the history
…ine#4194)

# Objective

Fixes bevyengine#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 authored and ItsDoot committed Feb 1, 2023
1 parent 3b796ca commit 288bd27
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 288bd27

Please sign in to comment.