Add run condition for whether egui is using pointer input
jakobhellermann opened this issue · comments
Jakob Hellermann commented
It came up in jakobhellermann/bevy-inspector-egui#147 that it is often useful to run some systems (like looking around) only if egui is not using the pointer input.
mod common_conditions {
fn egui_mouse_unused(egui_contexts: Query<&EguiContext>) -> bool {
egui_contexts
.iter()
.all(|ctx| !ctx.get().wants_pointer_input())
}
}
app.add_systems(
Update,
(camera_pan, camera_zoom).run_if(bevy_egui::common_conditions::mouse_pointer_valid()),
)
For prior art, bevy also has some common_conditions
for various subcrates: