PdfCraft: An open-source PDF reader and editor written by scratch in pure Rust
Integration: no link or comment tip beside the open palette (#2685)
aiongg80d8c60ac282
diff --git a/crates/ui-egui/src/canvas.rs b/crates/ui-egui/src/canvas.rsindex 5cb2002f3..c7015c465 100644--- a/crates/ui-egui/src/canvas.rs+++ b/crates/ui-egui/src/canvas.rs@@ -3884,8 +3884,10 @@ pub fn document_area(app: &mut PdfCraftApp, index: usize, ui: &mut egui::Ui) {}}}- // Fill & Sign keeps its placement cursor clear of link/comment hover feedback.+ // Fill & Sign keeps its placement cursor clear of link/comment hover feedback. Tips+ // draw above the palette, so none shows while it is open, even beside it.if !matches!(tool, QuickTool::Fill(_))+ && unobstructed&& let Some(p) = pointer{for l in info.links.iter().filter(|l| l.page == i) {diff --git a/crates/ui-egui/tests/it/pointer.rs b/crates/ui-egui/tests/it/pointer.rsindex 282f53dc0..f16c53f57 100644--- a/crates/ui-egui/tests/it/pointer.rs+++ b/crates/ui-egui/tests/it/pointer.rs@@ -317,6 +317,28 @@ fn stamp_cursor_stays_off_the_command_palette() {assert_eq!(cursor_at(&mut h, beside), egui::CursorIcon::Crosshair);}+/// A link beside the open palette shows no tip: tips draw above the palette.+#[test]+fn link_tip_stays_off_while_the_palette_is_open() {+ use egui_kittest::kittest::Queryable;+ let mut h = open(link_pdf(), "300", false);+ h.state_mut().palette_open = true;+ h.run_steps(4);+ let palette = h.ctx.memory(|m| m.area_rect(egui::Id::new("palette"))).expect("palette shown");+ let beside = [60.0, 100.0, 150.0, 200.0, 240.0]+ .into_iter()+ .flat_map(|x| [305.0, 325.0, 345.0].map(|y| at(&h, x, y)))+ .find(|p| page(&h).contains(*p) && !palette.expand(40.0).contains(*p))+ .unwrap_or_else(|| panic!("no point of the link beside the palette {palette:?}, page {:?}", page(&h)));+ h.hover_at(beside);+ h.run_steps(3);+ assert!(h.query_by_label("https://example.org/").is_none(), "no tip beside the palette");+ h.state_mut().palette_open = false;+ h.hover_at(beside);+ h.run_steps(3);+ h.get_by_label("https://example.org/");+}+fn wheel(h: &mut Harness<'_, PdfCraftApp>, delta: egui::Vec2) {h.hover_at(egui::pos2(800.0, 500.0));h.event(egui::Event::MouseWheel { unit: egui::MouseWheelUnit::Point, delta, modifiers: egui::Modifiers::NONE, phase: egui::TouchPhase::Move });