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 <noreply@anthropic.com>
This commit is contained in:
paaspaas00
2026-10-21 19:01:26 +02:00
co-authored by Claude Opus 5.5
parent ff5b065faf
commit d0e90e71ca
2 changed files with 7 additions and 2 deletions
+4
View File
@@ -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]
+3 -2
View File
@@ -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 }
}
}