From 35f3fe027e033d545c84cb13f8afcbebfbb8d21c Mon Sep 17 00:00:00 2001 From: aiongg Date: Sat, 24 Oct 2026 07:20:42 +0000 Subject: [PATCH] Integration: #3694 a press beneath a menu or dialog does not end Select All The reset uses pressed_page (unobstructed, pointer over the page) instead of the raw press origin; the test presses with a dialog open. --- crates/ui-egui/src/canvas.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/crates/ui-egui/src/canvas.rs b/crates/ui-egui/src/canvas.rs index 76120a4b70..a0e80e0aab 100644 --- a/crates/ui-egui/src/canvas.rs +++ b/crates/ui-egui/src/canvas.rs @@ -3652,7 +3652,8 @@ pub fn document_area(app: &mut PdfCraftApp, index: usize, ui: &mut egui::Ui) { // Any press on the page ends Select All of the document: text read or not, any tool, // on a link too. - if view.all_text && ui.input(|inp| inp.pointer.primary_pressed() && inp.pointer.press_origin().is_some_and(|o| r.contains(o))) { + // A press that lands on something drawn over the page (a menu, a dialog) is not one. + if view.all_text && pressed_page == Some(i) { view.all_text = false; } // Text layer: find matches, selection, I-beam and drag-to-select. @@ -6312,6 +6313,17 @@ trailer << /Root 1 0 R >> h.event(egui::Event::PointerButton { pos: at, button: egui::PointerButton::Primary, pressed: false, modifiers: egui::Modifiers::NONE }); h.run_steps(2); assert!(!h.state().views[0].all_text, "a press on the page ends it"); + + // A press while a dialog is up lands on the dialog, not the page: the selection stays. + h.state_mut().views[0].select_all(); + h.state_mut().dialog = Some(crate::Dialog::JsConsole); + h.run_steps(2); + h.event(egui::Event::PointerMoved(at)); + h.event(egui::Event::PointerButton { pos: at, button: egui::PointerButton::Primary, pressed: true, modifiers: egui::Modifiers::NONE }); + h.run_steps(1); + h.event(egui::Event::PointerButton { pos: at, button: egui::PointerButton::Primary, pressed: false, modifiers: egui::Modifiers::NONE }); + h.run_steps(2); + assert!(h.state().views[0].all_text, "a press beneath a dialog doesn't end it"); } /// The pages of a whole-document copy come out in order whatever was read before, and a