From 4e42650160b0d592635b89dfae5b2fab52c310a4 Mon Sep 17 00:00:00 2001 From: ardocrat Date: Sat, 5 Aug 2023 18:50:08 +0300 Subject: [PATCH] fix: Esc key press detection --- src/gui/app.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/app.rs b/src/gui/app.rs index 36f759c..d2c6e2d 100644 --- a/src/gui/app.rs +++ b/src/gui/app.rs @@ -14,7 +14,7 @@ use std::sync::atomic::{AtomicBool, Ordering}; -use egui::Context; +use egui::{Context, Modifiers}; use lazy_static::lazy_static; use crate::gui::Colors; @@ -44,7 +44,7 @@ impl eframe::App for PlatformApp { fn update(&mut self, ctx: &Context, frame: &mut eframe::Frame) { // Handle Esc keyboard key event and platform Back button key event. let back_button_pressed = BACK_BUTTON_PRESSED.load(Ordering::Relaxed); - if ctx.input(|i| i.key_pressed(egui::Key::Escape) || back_button_pressed) { + if ctx.input_mut(|i| i.consume_key(Modifiers::NONE, egui::Key::Escape)) || back_button_pressed { if back_button_pressed { BACK_BUTTON_PRESSED.store(false, Ordering::Relaxed); }