@@ -26,10 +26,8 @@ impl Plugin for KeybindingMenuPlugin {
2626 (
2727 update_button_text,
2828 (
29- cancel_binding
30- . never_param_warn ( )
31- . run_if ( input_just_pressed ( KeyCode :: Escape ) ) ,
32- bind. never_param_warn ( ) ,
29+ cancel_binding. run_if ( input_just_pressed ( KeyCode :: Escape ) ) ,
30+ bind,
3331 )
3432 . chain ( ) ,
3533 ) ,
@@ -62,11 +60,11 @@ fn setup(mut commands: Commands) {
6260
6361 // We use separate root node to let dialogs cover the whole UI.
6462 commands
65- . spawn ( ( Node {
63+ . spawn ( Node {
6664 width : Val :: Percent ( 100.0 ) ,
6765 height : Val :: Percent ( 100.0 ) ,
6866 ..Default :: default ( )
69- } , ) )
67+ } )
7068 . with_children ( |parent| {
7169 parent
7270 . spawn ( Node {
@@ -124,7 +122,7 @@ struct SettingsField(&'static str);
124122/// Number of input columns.
125123const INPUTS_PER_ACTION : usize = 3 ;
126124
127- fn setup_actions ( parent : & mut ChildBuilder , settings : & KeyboardSettings ) -> Entity {
125+ fn setup_actions ( parent : & mut ChildSpawnerCommands , settings : & KeyboardSettings ) -> Entity {
128126 parent
129127 . spawn ( Node {
130128 display : Display :: Grid ,
@@ -172,7 +170,7 @@ fn setup_actions(parent: &mut ChildBuilder, settings: &KeyboardSettings) -> Enti
172170}
173171
174172fn setup_action_row (
175- parent : & mut ChildBuilder ,
173+ parent : & mut ChildSpawnerCommands ,
176174 name : & ' static str ,
177175 inputs : & [ Input ] ,
178176 field : SettingsField ,
@@ -210,7 +208,7 @@ fn delete_binding(
210208 mut input_buttons : Query < ( & Name , & mut InputButton ) > ,
211209 delete_buttons : Query < & DeleteButton > ,
212210) {
213- let delete_button = delete_buttons. get ( trigger. entity ( ) ) . unwrap ( ) ;
211+ let delete_button = delete_buttons. get ( trigger. target ( ) ) . unwrap ( ) ;
214212 let ( name, mut input_button) = input_buttons
215213 . get_mut ( delete_button. button_entity )
216214 . expect ( "delete button should point to an input button" ) ;
@@ -221,16 +219,16 @@ fn delete_binding(
221219fn show_binding_dialog (
222220 trigger : Trigger < Pointer < Click > > ,
223221 mut commands : Commands ,
224- root_entity : Single < Entity , ( With < Node > , Without < Parent > ) > ,
222+ root_entity : Single < Entity , ( With < Node > , Without < ChildOf > ) > ,
225223 names : Query < & Name > ,
226224) {
227- let name = names. get ( trigger. entity ( ) ) . unwrap ( ) ;
225+ let name = names. get ( trigger. target ( ) ) . unwrap ( ) ;
228226 info ! ( "starting binding for '{name}'" ) ;
229227
230228 commands. entity ( * root_entity) . with_children ( |parent| {
231229 parent
232230 . spawn ( BindingDialog {
233- button_entity : trigger. entity ( ) ,
231+ button_entity : trigger. target ( ) ,
234232 } )
235233 . with_children ( |parent| {
236234 parent
@@ -264,7 +262,7 @@ fn bind(
264262 mut key_events : EventReader < KeyboardInput > ,
265263 mut mouse_button_events : EventReader < MouseButtonInput > ,
266264 dialog : Single < ( Entity , & BindingDialog ) > ,
267- root_entity : Single < Entity , ( With < Node > , Without < Parent > ) > ,
265+ root_entity : Single < Entity , ( With < Node > , Without < ChildOf > ) > ,
268266 mut buttons : Query < ( Entity , & Name , & mut InputButton ) > ,
269267) {
270268 let keys = key_events
@@ -337,12 +335,12 @@ fn bind(
337335 button. input = Some ( input) ;
338336 }
339337
340- commands. entity ( dialog_entity) . despawn_recursive ( ) ;
338+ commands. entity ( dialog_entity) . despawn ( ) ;
341339}
342340
343341fn cancel_binding ( mut commands : Commands , dialog_entity : Single < Entity , With < BindingDialog > > ) {
344342 info ! ( "cancelling binding" ) ;
345- commands. entity ( * dialog_entity) . despawn_recursive ( ) ;
343+ commands. entity ( * dialog_entity) . despawn ( ) ;
346344}
347345
348346fn replace_binding (
@@ -364,7 +362,7 @@ fn replace_binding(
364362 button. input = input;
365363
366364 info ! ( "reassigning binding to '{name}'" ) ;
367- commands. entity ( dialog_entity) . despawn_recursive ( ) ;
365+ commands. entity ( dialog_entity) . despawn ( ) ;
368366}
369367
370368fn cancel_replace_binding (
@@ -373,7 +371,7 @@ fn cancel_replace_binding(
373371 dialog_entity : Single < Entity , With < ConflictDialog > > ,
374372) {
375373 info ! ( "cancelling replace binding" ) ;
376- commands. entity ( * dialog_entity) . despawn_recursive ( ) ;
374+ commands. entity ( * dialog_entity) . despawn ( ) ;
377375}
378376
379377fn apply (
@@ -432,13 +430,13 @@ fn update_button_background(
432430#[ derive( Component , Default ) ]
433431#[ require(
434432 Button ,
435- Node ( || Node {
433+ Node {
436434 justify_content: JustifyContent :: Center ,
437435 align_items: AlignItems :: Center ,
438436 width: Val :: Px ( 160.0 ) ,
439437 height: Val :: Px ( 35.0 ) ,
440438 ..Default :: default ( )
441- } ) ,
439+ } ,
442440) ]
443441struct SettingsButton ;
444442
@@ -454,13 +452,13 @@ struct InputButton {
454452#[ derive( Component ) ]
455453#[ require(
456454 Button ,
457- Node ( || Node {
455+ Node {
458456 justify_content: JustifyContent :: Center ,
459457 align_items: AlignItems :: Center ,
460458 width: Val :: Px ( 35.0 ) ,
461459 height: Val :: Px ( 35.0 ) ,
462460 ..Default :: default ( )
463- } ) ,
461+ } ,
464462) ]
465463struct DeleteButton {
466464 /// Entity with [`InputButton`].
@@ -469,16 +467,16 @@ struct DeleteButton {
469467
470468#[ derive( Component , Default ) ]
471469#[ require(
472- Node ( || Node {
470+ Node {
473471 position_type: PositionType :: Absolute ,
474472 width: Val :: Percent ( 100.0 ) ,
475473 height: Val :: Percent ( 100.0 ) ,
476474 align_items: AlignItems :: Center ,
477475 justify_content: JustifyContent :: Center ,
478476 ..Default :: default ( )
479- } ) ,
480- FocusPolicy ( || FocusPolicy :: Block ) ,
481- BackgroundColor ( || BackgroundColor ( Color :: srgba( 1.0 , 1.0 , 1.0 , 0.3 ) ) ) ,
477+ } ,
478+ FocusPolicy :: Block ,
479+ BackgroundColor ( Color :: srgba( 1.0 , 1.0 , 1.0 , 0.3 ) ) ,
482480) ]
483481struct Dialog ;
484482
0 commit comments