This system handles changing all buttons color based on mouse interaction
(
mut interaction_query: Query<
(&Interaction, &mut BackgroundColor, Option<&SelectedOption>),
(Changed<Interaction>, With<Button>),
>,
)
| 81 | } |
| 82 | // This system handles changing all buttons color based on mouse interaction |
| 83 | fn button_system( |
| 84 | mut interaction_query: Query< |
| 85 | (&Interaction, &mut BackgroundColor, Option<&SelectedOption>), |
| 86 | (Changed<Interaction>, With<Button>), |
| 87 | >, |
| 88 | ) { |
| 89 | for (interaction, mut color, selected) in &mut interaction_query { |
| 90 | *color = match (*interaction, selected) { |
| 91 | (Interaction::Pressed, _) | (Interaction::None, Some(_)) => PRESSED_BUTTON.into(), |
| 92 | (Interaction::Hovered, Some(_)) => HOVERED_PRESSED_BUTTON.into(), |
| 93 | (Interaction::Hovered, None) => HOVERED_BUTTON.into(), |
| 94 | (Interaction::None, None) => NORMAL_BUTTON.into(), |
| 95 | } |
| 96 | } |
| 97 | } |
| 98 | |
| 99 | fn menu_action( |
| 100 | interaction_query: Query< |
nothing calls this directly
no outgoing calls
no test coverage detected