From 5f9b03d217bfb5eee5e8b59e2275dca0451d989a Mon Sep 17 00:00:00 2001 From: Luke Yoo Date: Mon, 9 Mar 2026 13:33:27 -0700 Subject: [PATCH 1/8] Squashed commit of the following: commit 15110ba9c4e1502940241206abf6fa12b156a47a Author: Luke Yoo Date: Mon Mar 9 13:31:24 2026 -0700 Remove trailing space from examples/mobile/src/lib.rs commit 26ebfb66e6165444b8b4a6dda3eeed74a6300331 Merge: 50e79d05b 7fc2e2da3 Author: Luke Yoo Date: Mon Mar 9 13:11:11 2026 -0700 Merge remote-tracking branch 'origin/main' into pre-op-interaction commit 50e79d05ba65738006e1b5df499ae4d531d98d54 Author: Luke Yoo Date: Mon Mar 9 03:08:05 2026 -0700 Remove `Interaction` from examples/mobile/src/lib.rs commit 914996bddcfb1353c6521812d18f35a893c81b98 Author: Luke Yoo Date: Mon Mar 9 02:50:51 2026 -0700 Remove `Interaction` from examples/3d/mirror.rs commit 1b93131ec4a48b664f56f4a7f7c66849d324c7ef Author: Luke Yoo Date: Mon Mar 9 01:40:04 2026 -0700 Remove helper from examples/animation/animation_graph.rs commit d6df05bd645743128eb13a1bc491579ca460247c Author: Luke Yoo Date: Mon Mar 9 00:18:39 2026 -0700 Remove `LegacyInteraction` commit fd91021d8a3351c54797f2b56de4b78f9fc1ab80 Author: Luke Yoo Date: Mon Mar 9 00:17:13 2026 -0700 Remove helper from examples/ui/scroll_and_overflow/overflow.rs commit 1edf379f0b1e9585beae9acb87b079a1f83a5925 Author: Luke Yoo Date: Mon Mar 9 00:08:26 2026 -0700 Remove the helper from examples/ui/widgets/tab_navigation.rs commit b44ac03d0e1041fd867caaadaba7e9c88e163e69 Author: Luke Yoo Date: Sun Mar 8 23:59:13 2026 -0700 Remove `LegacyInteraction` from examples/ui/widgets/button.rs commit 47c5facde79114ef084118b0a8fa4c27ca5c6f32 Author: Luke Yoo Date: Sun Mar 8 16:24:51 2026 -0700 Remove `LegacyInteraction` from examples/state/computed_states.rs commit 43042edd4cd3f18aa4ab33e7e461a82bdf519cb1 Author: Luke Yoo Date: Sun Mar 8 16:05:15 2026 -0700 Remove `LegacyInteraction` from examples/games/game_menu.rs commit e0414e0b84402029bb8252b2125a4fa97802e1a4 Author: Luke Yoo Date: Sun Mar 8 14:07:57 2026 -0700 Remove `LegacyInteraction` from examples/ui/layout/size_constraints.rs commit 59e51fc8675307ecd2c45725f7de0a65b4e9c12c Author: Luke Yoo Date: Sun Mar 8 13:52:58 2026 -0700 Remove `Interaction` from examples/testbed/ui.rs commit ce57795ac7541a8bb834d6c3217f4de13876b9f1 Author: Luke Yoo Date: Sun Mar 8 13:46:32 2026 -0700 Remove `Interaction` from examples/stress_tests/many_buttons.rs commit 28a8fba6006fbd02e1fd4e9ccb224231b8073b85 Author: Luke Yoo Date: Sun Mar 8 13:20:16 2026 -0700 Remove `Interaction` from examples/ui/styling/box_shadow.rs commit 08d9a649760b5858b5e636c917d11f375e27c1f1 Author: Luke Yoo Date: Sun Mar 8 12:59:56 2026 -0700 Change button system to observer style in examples/ui/images/ui_texture_slice.rs commit 39734793c3f304691bca7639ba872fb53f89f3ee Author: Luke Yoo Date: Sun Mar 8 12:59:11 2026 -0700 Remove `Interaction` from examples/ui/images/ui_texture_atlas_slice.rs commit 096abf3725f560d306f3de9705a0f8c2ca66eac4 Author: Luke Yoo Date: Sun Mar 8 01:45:41 2026 -0800 Remove `Interaction` from examples/ui/images/ui_texture_slice.rs commit 86dcba05a93b5de8c0fd0660159a62ebe67d6e2d Author: Luke Yoo Date: Sun Mar 8 01:38:56 2026 -0800 Remove `Interaction` from examples/ui/ui_transform.rs commit 1d5edd8d232d46f655cd5ce04338bccbb67e2a7c Author: Luke Yoo Date: Sun Mar 8 01:28:58 2026 -0800 Remove `Interaction` from examples/state/custom_transitions.rs commit 8a22aedaa57e33ea656ba3f27a5a017ea48f98f6 Author: Luke Yoo Date: Sun Mar 8 01:20:06 2026 -0800 Remove `Interaction` from examples/ui/layout/display_and_visibility.rs commit 9da7d85d2c2928dfc844539c6128c7eee9b7bccb Author: Luke Yoo Date: Sun Mar 8 01:10:08 2026 -0800 Remove `Interaction` from examples/state/sub_states.rs commit fa404cd94e1743aa4062e3790e761f7fba02428b Author: Luke Yoo Date: Sun Mar 8 01:00:05 2026 -0800 Remove `Interaction` from examples/state/states.rs commit b7d2a3d039ae2bb581198bdc0436abe0d2b6c68a Author: Luke Yoo Date: Sat Mar 7 16:05:24 2026 -0800 Remove `Interaction` from examples/ui/widgets/tab_navigation.rs commit ffe074a893d524c0c5ea35573a91d409cffdf0e4 Author: Luke Yoo Date: Sat Mar 7 15:59:35 2026 -0800 Remove `Intereaction` from examples/ui/layout/size_constraints.rs commit 7fd9e49bac14d42dd225391c54cf279d6ab9437b Author: Luke Yoo Date: Sat Mar 7 15:53:21 2026 -0800 Remove `Interaction` from examples/state/computed_states.rs commit 3f4646c55b9c4a079192d085182062ec4daa46f1 Author: Luke Yoo Date: Sat Mar 7 15:47:04 2026 -0800 Remove `Interaction` from examples/ui/widgets/button.rs commit bd77a7fef7afb80adf6aa13fed8205a2e95b76c3 Author: Luke Yoo Date: Sat Mar 7 11:55:50 2026 -0800 Remove `Interaction` from examples/games/game_menu.rs commit 063a9b0c750ee264f8f13023aa20d090407fda1a Author: Luke Yoo Date: Sat Mar 7 11:52:25 2026 -0800 Format examples that have been worked on commit 2a65db93ea96ed4d38925441469869e68e604740 Merge: 1e6ced2ec 162a70809 Author: Luke Yoo Date: Sat Mar 7 10:54:46 2026 -0800 Merge remote-tracking branch 'origin/main' into pre-op-interaction commit 1e6ced2ec5a77ef63aa03917545214b92732c94a Author: Luke Yoo Date: Thu Mar 5 19:23:24 2026 -0800 Remove `Interaction` from examples/animation/animation_masks.rs commit 2b0d2d389a058713fde4dd1cc88f52a28ac7e63c Author: Luke Yoo Date: Thu Mar 5 18:51:18 2026 -0800 Remove `Interaction` from examples/3d/light_textures.rs commit d37e5c6aa16d2dc3fe4431ecf42830418c2d6932 Author: Luke Yoo Date: Thu Mar 5 18:30:16 2026 -0800 Remove `Interaction` from examples/ui/layout/ghost_nodes.rs commit cc4c2c65ddbfecbef587869862766ed261883365 Author: Luke Yoo Date: Thu Mar 5 17:59:57 2026 -0800 Remove `Interaction` from examples/usage/cooldown.rs commit 0a3af15c3db24aa0af676574939fe638f2dac041 Author: Luke Yoo Date: Thu Mar 5 17:03:42 2026 -0800 Remove `Interaction` from examples/3d/split_screen.rs commit 459c87a833c4e17ec56faf53d5d57cfed620dc7d Author: Luke Yoo Date: Thu Mar 5 16:45:33 2026 -0800 Remove `Interaction` from examples/helpers/widgets.rs commit 98e1e2c6cdf39857d1bf837605f9c22adb96667a Merge: 0bacdb25d f36f54d93 Author: Luke Yoo Date: Thu Mar 5 14:23:01 2026 -0800 Merge remote-tracking branch 'origin/main' into pre-op-interaction commit 0bacdb25d0a90f126cdc6df079e9f5615f1c26b4 Author: Luke Yoo Date: Wed Mar 4 16:32:29 2026 -0800 Remove `Interaction` from examples/3d/color_grading.rs commit 2ea4c0becbabfccdbfa4c85b191c7ee3b0f5a847 Author: Luke Yoo Date: Wed Mar 4 15:52:38 2026 -0800 Remove `Interaction` from examples/3d/clustered_decals.rs --- examples/2d/dynamic_mip_generation.rs | 13 +-- examples/3d/clustered_decal_maps.rs | 12 ++- examples/3d/clustered_decals.rs | 17 ++-- examples/3d/color_grading.rs | 23 +++--- examples/3d/contact_shadows.rs | 9 ++- examples/3d/light_probe_blending.rs | 29 ++----- examples/3d/light_textures.rs | 20 +++-- examples/3d/mirror.rs | 40 ++++++---- examples/3d/mixed_lighting.rs | 2 +- examples/3d/pccm.rs | 9 ++- examples/3d/pcss.rs | 5 +- examples/3d/split_screen.rs | 40 +++++----- examples/3d/ssr.rs | 4 +- examples/animation/animation_graph.rs | 28 ++++--- examples/animation/animation_masks.rs | 50 ++++++------ examples/games/game_menu.rs | 83 ++++++++++---------- examples/helpers/widgets.rs | 17 ++-- examples/mobile/src/lib.rs | 41 +++++----- examples/state/computed_states.rs | 46 +++++++---- examples/state/custom_transitions.rs | 37 +++++---- examples/state/states.rs | 36 +++++---- examples/state/sub_states.rs | 36 +++++---- examples/stress_tests/many_buttons.rs | 19 +++-- examples/testbed/ui.rs | 1 - examples/ui/images/ui_texture_atlas_slice.rs | 33 +++++--- examples/ui/images/ui_texture_slice.rs | 33 +++++--- examples/ui/layout/display_and_visibility.rs | 83 ++++++++++---------- examples/ui/layout/ghost_nodes.rs | 19 ++--- examples/ui/layout/size_constraints.rs | 34 +++++--- examples/ui/scroll_and_overflow/overflow.rs | 41 +++++++--- examples/ui/styling/box_shadow.rs | 71 ++++++++++------- examples/ui/ui_transform.rs | 39 +++++---- examples/ui/widgets/button.rs | 51 ++++++------ examples/ui/widgets/tab_navigation.rs | 36 ++++++--- examples/usage/cooldown.rs | 45 +++++------ 35 files changed, 599 insertions(+), 503 deletions(-) diff --git a/examples/2d/dynamic_mip_generation.rs b/examples/2d/dynamic_mip_generation.rs index 8e776ee749f34..69c6bd0581384 100644 --- a/examples/2d/dynamic_mip_generation.rs +++ b/examples/2d/dynamic_mip_generation.rs @@ -225,11 +225,7 @@ fn main() { .add_systems(Update, animate_image_scale) .add_systems( Update, - ( - widgets::handle_ui_interactions::, - update_radio_buttons, - ) - .chain(), + update_radio_buttons.run_if(resource_changed::), ) .add_systems( Update, @@ -237,10 +233,9 @@ fn main() { ) .add_systems( Update, - handle_app_setting_change - .after(widgets::handle_ui_interactions::) - .before(regenerate_image_when_requested), - ); + handle_app_setting_change.before(regenerate_image_when_requested), + ) + .add_observer(widgets::handle_ui_button_interaction_on_click::); // Because `MipGenerationJobs` is part of the render app, we need to add the // associated systems to that app, not the main one. diff --git a/examples/3d/clustered_decal_maps.rs b/examples/3d/clustered_decal_maps.rs index 0354b359b1f07..1e2b01d55802b 100644 --- a/examples/3d/clustered_decal_maps.rs +++ b/examples/3d/clustered_decal_maps.rs @@ -152,14 +152,12 @@ fn main() { .add_systems( Update, ( - widgets::handle_ui_interactions::, - update_radio_buttons, - ), - ) - .add_systems( - Update, - handle_emission_type_change.after(widgets::handle_ui_interactions::), + handle_emission_type_change, + update_radio_buttons.run_if(resource_changed::), + ) + .chain(), ) + .add_observer(widgets::handle_ui_button_interaction_on_click::) .insert_resource(SeededRng(ChaCha8Rng::seed_from_u64(19878367467712))) .run(); } diff --git a/examples/3d/clustered_decals.rs b/examples/3d/clustered_decals.rs index d0b8b5bc11174..da17284a9dcaf 100644 --- a/examples/3d/clustered_decals.rs +++ b/examples/3d/clustered_decals.rs @@ -8,6 +8,7 @@ use bevy::{ input::mouse::AccumulatedMouseMotion, light::ClusteredDecal, pbr::{decal, ExtendedMaterial, MaterialExtension}, + picking::hover::Hovered, prelude::*, render::{ render_resource::AsBindGroup, @@ -135,11 +136,13 @@ fn main() { .add_systems(Startup, setup) .add_systems(Update, draw_gizmos) .add_systems(Update, rotate_cube) - .add_systems(Update, widgets::handle_ui_interactions::) .add_systems( Update, - (handle_selection_change, update_radio_buttons) - .after(widgets::handle_ui_interactions::), + ( + handle_selection_change, + update_radio_buttons.run_if(resource_changed::), + ) + .chain(), ) .add_systems(Update, process_move_input) .add_systems(Update, process_scale_input) @@ -147,6 +150,7 @@ fn main() { .add_systems(Update, switch_drag_mode) .add_systems(Update, update_help_text) .add_systems(Update, update_button_visibility) + .add_observer(widgets::handle_ui_button_interaction_on_click::) .run(); } @@ -288,6 +292,7 @@ fn drag_button(label: &str) -> impl Bundle { }, Button, BackgroundColor(Color::BLACK), + Hovered::default(), BUTTON_BORDER_COLOR, children![widgets::ui_text(label, Color::WHITE)], ) @@ -490,7 +495,7 @@ fn create_help_string(app_status: &AppStatus) -> String { /// mode back to its default value of [`DragMode::Move`]. fn switch_drag_mode( mut commands: Commands, - mut interactions: Query<(&Interaction, &DragMode)>, + mut button_interactions: Query<(&Hovered, &DragMode), With