From d0e90e71cabcca305c94bc5eb14fe3920b56208d Mon Sep 17 00:00:00 2001 From: paaspaas00 <151774837+paaspaas00@users.noreply.github.com> Date: Wed, 21 Oct 2026 19:01:26 +0200 Subject: [PATCH] Place cursor: the crosshair throughout when no graphic is loaded With nothing in the place cursor there's no thumbnail to show, so the cursor is the crosshair before a press too, as it already was while dragging. (Review.) Co-Authored-By: Claude Opus 5.5 --- crates/engine/src/tests.rs | 4 ++++ crates/tools/src/nav.rs | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rs index 3eb129c83..b43ef439e 100644 --- a/crates/engine/src/tests.rs +++ b/crates/engine/src/tests.rs @@ -527,6 +527,10 @@ Y: 100.00%")), s.pointer(&PointerEvent::new(PointerKind::Up, 102.5, 501.25), v).unwrap(); let it = s.doc().unwrap().doc.spreads[0].items.last().unwrap().clone(); assert_eq!(it.bounds(), designcraft_geom::Rect::new(100.0, 500.0, 140.0, 520.0), "actual size at the press"); + // With no graphic loaded there's no thumbnail to show: the crosshair, before any press too. + s.loaded = None; + s.set_tool("placeGun"); + assert_eq!(s.cursor(p(300.0, 300.0), Mods::default(), v), Cursor::Crosshair); } #[test] diff --git a/crates/tools/src/nav.rs b/crates/tools/src/nav.rs index 95b471e4e..74a8c5074 100644 --- a/crates/tools/src/nav.rs +++ b/crates/tools/src/nav.rs @@ -191,8 +191,9 @@ Y: {pct}" fn cursor(&self, cx: &ToolContext, _p: Point, _m: Mods) -> Cursor { // Drawing the frame: the crosshair (the loaded graphic's thumbnail would hide the frame). // Under the drag threshold no frame is drawn yet (the release is a click), so the - // thumbnail stays, as the overlay does. - let drawing = self.start.is_some_and(|a| cx.loaded.is_none() || (self.cur - a).hypot() >= cx.tol(3.0)); + // thumbnail stays, as the overlay does. With no graphic loaded there's no thumbnail to + // show: the crosshair throughout. + let drawing = cx.loaded.is_none() || self.start.is_some_and(|a| (self.cur - a).hypot() >= cx.tol(3.0)); if drawing { Cursor::Crosshair } else { Cursor::LoadedGraphic } } }