yeah that works

main
Elijah Voigt 3 months ago
parent 6433f7bb6a
commit 0df33ee4a6

@ -97,7 +97,7 @@ fn init_debug_ui(mut commands: Commands) {
justify_self: JustifySelf::Start, justify_self: JustifySelf::Start,
..default() ..default()
}, },
)); )).observe(close_on_click);
// "Turn on Debugging" button // "Turn on Debugging" button
commands commands
@ -390,3 +390,12 @@ fn toggle_debug(
DebuggingState::Off => DebuggingState::On, DebuggingState::Off => DebuggingState::On,
}); });
} }
fn close_on_click(
trigger: Trigger<Pointer<Click>>,
mut query: Query<&mut Visibility>,
) {
if let Ok(mut v) = query.get_mut(trigger.target()) {
*v = Visibility::Hidden;
}
}

@ -163,11 +163,12 @@ pub struct SyncResource<R: Resource + Default + Display>(R);
/// ///
/// Mostly useful for quick n' dirty getting data to the user /// Mostly useful for quick n' dirty getting data to the user
pub fn sync_resource_to_ui<R: Resource + Default + Display>( pub fn sync_resource_to_ui<R: Resource + Default + Display>(
mut q: Query<&mut Text, With<SyncResource<R>>>, mut q: Query<(&mut Text, &mut Visibility), With<SyncResource<R>>>,
r: Res<R>, r: Res<R>,
) { ) {
q.iter_mut().for_each(|mut t| { q.iter_mut().for_each(|(mut t, mut v)| {
t.0 = format!("{}", *r); t.0 = format!("{}", *r);
*v = Visibility::Inherited;
}); });
} }

Loading…
Cancel
Save