Place cursor: the thumbnail stays until a drag starts drawing the frame

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
paaspaas00andClaude Opus 5.5 committed 2026-10-21 15:33:11 +02:00
1 parent 098613b75d
commit ff5b065faf
2 files changed
+6 -2

No files matched your search

+1
View File
@@ -523,6 +523,7 @@ Y: 100.00%")),
s.pointer(&PointerEvent::new(PointerKind::Down, 100.0, 500.0), v).unwrap();
s.pointer(&PointerEvent::new(PointerKind::Drag, 102.5, 501.25), v).unwrap();
assert!(!s.overlays(v).iter().any(|o| matches!(o, Overlay::Marquee(_))), "no frame yet");
assert_eq!(s.cursor(p(102.5, 501.25), Mods::default(), v), Cursor::LoadedGraphic, "the thumbnail stays");
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");
+5 -2
View File
@@ -188,9 +188,12 @@ Y: {pct}"
_ => vec![],
}
}
fn cursor(&self, _cx: &ToolContext, _p: Point, _m: Mods) -> Cursor {
fn cursor(&self, cx: &ToolContext, _p: Point, _m: Mods) -> Cursor {
// Drawing the frame: the crosshair (the loaded graphic's thumbnail would hide the frame).
if self.start.is_some() { Cursor::Crosshair } else { Cursor::LoadedGraphic }
// 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));
if drawing { Cursor::Crosshair } else { Cursor::LoadedGraphic }
}
}