diff --git a/src/widgets.rs b/src/widgets.rs index c7d81c9..598d80b 100644 --- a/src/widgets.rs +++ b/src/widgets.rs @@ -20,7 +20,7 @@ pub fn spawn_cutter_machine_ui(mut commands: Commands) { Pickable::default(), children![(Text::new("Uses: "), TextColor(BLACK.into()),)], )); - + // Center panel (placeholder for the Card view) commands.spawn(( Node::default(), @@ -119,4 +119,67 @@ fn spawn_machine_button(commands: &mut ChildSpawnerCommands) { TextShadow::default(), ], )); + builder.observe(button_hover_start); + builder.observe(button_hover_stop); + builder.observe(button_press_start); + builder.observe(button_press_stop); + builder.observe(second_on_press_event); +} + +/// Re-color the button when a pointer passes over it +fn button_hover_start( + event: Trigger>, + // Get button background and border colors so we can change them. + // Filter for *changed* interactions, and only entities with a [`Button`] + mut button_colors: Query<(&mut BackgroundColor, &mut BorderColor), With