DesignCraft: An open-source page and layout design editor written by scratch in pure Rust
Place cursor: the thumbnail stays until a drag starts drawing the frame
paaspaas00ff5b065fafdc
diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rsindex adaa0fe8e..3eb129c83 100644--- a/crates/engine/src/tests.rs+++ b/crates/engine/src/tests.rs@@ -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");diff --git a/crates/tools/src/nav.rs b/crates/tools/src/nav.rsindex cbefbd448..95b471e4e 100644--- a/crates/tools/src/nav.rs+++ b/crates/tools/src/nav.rs@@ -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 }}}