DesignCraft: An open-source page and layout design editor written by scratch in pure Rust
Frame tools: the size readout shows the document's units, as InDesign's
moppeeer09970a24b0a9
diff --git a/ROADMAP.md b/ROADMAP.mdindex 0128924c0..56ff46903 100644--- a/ROADMAP.md+++ b/ROADMAP.md@@ -348,6 +348,7 @@ list) · [roadmap.md](docs/roadmap.md) (milestones, plan) · [parity-checklist.mNewest first.+- **2026-10-20** · Drawing a frame or shape shows its width and height in the document's ruler units, to two decimals and on two lines ("W: 6.08 cm", "H: 6.08 cm"), as InDesign does; it was always whole points. No readiness percentage change.- **2026-10-16** · Type › Reload Fonts (`font.reload`): fonts installed, edited or removed while DesignCraft runs are read again without a restart, and the open documents recompose with them (#328, #547). An edited font file is noticed by its length and modification time; bundled, added and document fonts stay as they are. InDesign does this by itself, so noticing changes automatically is still open (gap 6). No readiness percentage change.- **2026-10-16** · Parents can be deleted from their Pages-panel context menu or `layout.parents.delete {id}`. Applied-page and based-on references are cleared, local override copies survive, and Undo restores the parent. Addresses the deletion portion of #956; no readiness percentage change.- **2026-10-17** · File › Package writes the document's and the IDML's links relative to the package (`Links/logo.png`, `file:Links/logo.png`), so a package holds no path from the machine that made it; opening a document resolves them to the files beside it. Links › Copy Link(s) To still links by full path. (#340). No readiness percentage change.diff --git a/crates/tools/src/frame.rs b/crates/tools/src/frame.rsindex 4b52e2ee5..aaebaefd7 100644--- a/crates/tools/src/frame.rs+++ b/crates/tools/src/frame.rs@@ -457,10 +457,14 @@ impl Tool for FrameTool {fn overlays(&self, cx: &ToolContext) -> Vec<Overlay> {if let (true, Some(a)) = (self.active, self.start) {- let r = Rect::from_points(a, self.cur);- let _ = cx;+ // The frame being drawn (Shift, Alt and snapping included), in the document's units+ // to two decimals, on two lines: InDesign's readout ("W: 3.13 cm", "H: 3.13 cm").+ let r = self.last.as_ref().map(|(_, r)| *r).unwrap_or_else(|| Rect::from_points(a, self.cur));+ let units = &cx.doc.settings;+ let w = designcraft_geom::units::format_measure_prec(r.width().abs(), units.horizontal_units, 2);+ let h = designcraft_geom::units::format_measure_prec(r.height().abs(), units.vertical_units, 2);let mut v = self.guides.clone();- v.push(Overlay::Measure { p: self.cur, text: format!("W: {:.0} pt H: {:.0} pt", r.width(), r.height()) });+ v.push(Overlay::Measure { p: self.cur, text: format!("W: {w}\nH: {h}") });return v;}vec![]diff --git a/crates/tools/src/tests.rs b/crates/tools/src/tests.rsindex ee3b362f1..d39fb6433 100644--- a/crates/tools/src/tests.rs+++ b/crates/tools/src/tests.rs@@ -69,6 +69,30 @@ fn frame_tool_drag_emits_begin_preview_commit() {assert_eq!(t.pointer(&cx, &PointerEvent::new(PointerKind::Up, 110.0, 60.0)), vec![Action::Commit]);}+/// While a frame is drawn, its size shows in the document's units, as InDesign's readout does+/// ("W: 6.08 cm" over "H: 6.08 cm" in Zero2Graphic's page layout tutorial, 0:43).+#[test]+fn frame_tool_readout_shows_the_size_in_the_document_units() {+ let mut d = Document::new(&NewDocument::default());+ d.settings.horizontal_units = Unit::Centimeters;+ d.settings.vertical_units = Unit::Centimeters;+ let (s, c, l) = (Selection::default(), Cache::new(), CanvasLayout::new(&d, false));+ let cx = ctx(&d, &s, &c, &l);+ let mut t = create("rectangleFrame");+ t.pointer(&cx, &PointerEvent::new(PointerKind::Down, 10.0, 10.0));+ // 172.35 pt square: 6.08 cm.+ t.pointer(&cx, &PointerEvent::new(PointerKind::Drag, 182.35, 182.35));+ let texts: Vec<String> = t+ .overlays(&cx)+ .into_iter()+ .filter_map(|o| match o {+ Overlay::Measure { text, .. } => Some(text),+ _ => None,+ })+ .collect();+ assert_eq!(texts, vec!["W: 6.08 cm\nH: 6.08 cm".to_string()]);+}+#[test]fn selection_click_and_marquee() {let mut d = Document::new(&NewDocument::default());