Skip to content

Commit

Permalink
Ignore space bar when editing text field (EmbarkStudios#159)
Browse files Browse the repository at this point in the history
  • Loading branch information
emilk authored and plasticbox committed Nov 9, 2023
1 parent 2aad8f2 commit 8c3dba8
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions puffin_egui/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -504,12 +504,15 @@ impl ProfilerUi {

ui.horizontal(|ui| {
let play_pause_button_size = Vec2::splat(24.0);
let space_pressed =
ui.input(|i| i.key_pressed(egui::Key::Space)) && ui.memory(|m| m.focus().is_none());

if self.paused.is_some() {
if ui
.add_sized(play_pause_button_size, egui::Button::new("▶"))
.on_hover_text("Show latest data. Toggle with space.")
.clicked()
|| ui.input(|i| i.key_pressed(egui::Key::Space))
|| space_pressed
{
self.paused = None;
}
Expand All @@ -519,7 +522,7 @@ impl ProfilerUi {
.add_sized(play_pause_button_size, egui::Button::new("⏸"))
.on_hover_text("Pause on this frame. Toggle with space.")
.clicked()
|| ui.input(|i| i.key_pressed(egui::Key::Space))
|| space_pressed
{
let latest = frame_view.latest_frame();
if let Some(latest) = latest {
Expand Down

0 comments on commit 8c3dba8

Please sign in to comment.