PhotoCraft: An open-source, photo editor written by scratch in pure Rust
fix(screen-picker): allow cancelling pending captures and avoid stale answers
Nigel Ihza Firdausy5d753525ccc9
diff --git a/crates/ui-egui/src/lib.rs b/crates/ui-egui/src/lib.rsindex c0d64e7c0..9a2f45047 100644--- a/crates/ui-egui/src/lib.rs+++ b/crates/ui-egui/src/lib.rs@@ -1740,10 +1740,16 @@ impl eframe::App for PhotocraftApp {crate::widgets::set_field_resolution(&ctx, dpi, ppi);// View › Screen Mode › Full Screen Mode: only the image, on black (F or Esc returns).screen_picker::show(&ctx);- if screen_picker::busy(&ctx) && screen_picker::showing(&ctx) {+ if screen_picker::busy(&ctx) {+ // While the capture service is still returning a snapshot there is no picker+ // viewport yet. Keep a visible Cancel action even during this phase (#4737).egui::Modal::new(egui::Id::new("screen-color-wait")).show(&ctx, |ui| {ui.spinner();- ui.label(tl!("Pick a screen pixel or press Esc to cancel"));+ ui.label(if screen_picker::showing(&ctx) {+ tl!("Pick a screen pixel or press Esc to cancel")+ } else {+ tl!("Preparing screen capture…")+ });if ui.button(tl!("Cancel")).clicked() {screen_picker::cancel(&ctx);}@@ -1751,10 +1757,6 @@ impl eframe::App for PhotocraftApp {self.automation_input = false;return;}- if screen_picker::busy(&ctx) {- ui.disable();- ui.set_opacity(1.0);- }// The OS title bar (and the taskbar / Alt-Tab entry) follows the active file; with the// system title bar this is where the document name lives, as the in-app title is hidden.panels::sync_window_title(self, &ctx);