DesignCraft: An open-source page and layout design editor written by scratch in pure Rust
PR-902: refresh against main and resolve review findings
moppeeerebc59b74e1de
diff --cc ROADMAP.mdindex ea9fae26a,0128924c0..bd34eed1e--- a/ROADMAP.md+++ b/ROADMAP.md@@@ -343,15 -346,70 +346,72 @@@ list) · [roadmap.md](docs/roadmap.md)## Progress log- - **2026-10-13** · Switching between document and parent pages refreshes the canvas immediately, preventing black parent pages and stale document objects when the zoom stays the same. Ordinary edits retain partial repainting. No readiness percentage change.-Newest first.+- **2026-10-14** · The Direct Selection tool pressed on a corner or anchor of an object that isn't selected selects it and pulls just that point, as in InDesign (it moved the whole object). No readiness percentage change.- - **2026-10-14** · The Type tool draws a new text frame over a locked empty frame, as InDesign does, instead of turning the locked frame into a text frame. No readiness percentage change.- - **2026-10-14** · 100% black shows as pure black on screen by default, as InDesign's Appearance of Black does out of the box (Display All Blacks as Rich Black); Preferences › Appearance of Black › Display All Blacks Accurately still shows it as the dark grey it prints, and a saved choice is kept. No readiness percentage change.- - **2026-10-14** · Pathfinder keeps the frontmost object, as InDesign does: a photo placed over shapes and intersected with them shows through the shapes (it was dropped, and the shapes kept their black fill); Add, Exclude Overlap and Minus Back take the front object's fill too, Subtract still keeps the back one. No readiness percentage change.- - **2026-10-14** · The Color panel's Tint field keeps what is typed while it has focus and applies it on Enter or when it loses focus, clamped to 0–100 %. Typing 60 over 100 % no longer snaps back to 100 after the first digit (10060), and a typed tint is no longer ignored. 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.+ - **2026-10-18** · View › Screen Mode: Bleed and Slug do what they say. Both were selectable from the toolbar, the View menu and `view.screenMode` but drew the canvas exactly as Normal did, guides and all; they are preview modes now, and what each page shows reaches the bleed box or the slug box instead of stopping at the trim. The slug guide is drawn as well, in the Slug colour from Preferences › Guides & Pasteboard, which nothing had read. No readiness percentage change.+ - **2026-10-17** · Object strokes reject malformed types and unknown type fields before changing the document; command help lists every stroke kind and its required fields. No readiness percentage change.+ - **2026-10-17** · Docs: documented a persistent source CLI install with Cargo, MCP-client PATH setup and bare-name server registration in `docs/mcp.md`. No readiness percentage change.++ - **2026-10-16** · Threading: the loaded text cursor threads into a text frame inside a group (it hit the group and showed it could not thread); a plain click still selects the group (#1075). Gap 27 closed. No readiness percentage change.+ - **2026-10-16** · Greek text hyphenates. The patterns were never compiled in, so Greek set unhyphenated however narrow the column; `"Greek"`, `"Greek: Greece"`, `el` and `el-GR` all resolve now and ανθρωπος breaks αν-θρω-πος. They are the monotonic patterns (hyph-el-monoton, Dimitrios Filippou, under MIT), which is what polytonic text hyphenates by too. Five of InDesign's ~40 hyphenation languages. No readiness percentage change.+ - **2026-10-16** · A swatch applied to a placed greyscale or bitmap image colours it, as in InDesign: IDML's `<Image FillColor>` is read and written, greyscale pixels become a tint of the swatch on opaque white and a bitmap's white lets the frame show through, on screen and in PDF (spot swatches print on their plate). Colour images keep their colours. Applying the swatch from the Swatches panel comes next. No readiness percentage change.+ - **2026-10-15** · Color Theme: the toolbar tool previews up to five colours from a placed raster and adds them as one undoable swatch group. Local deterministic extraction; transparent padding is ignored. No readiness percentage change.+ - **2026-10-15** · Applying text styles removes matching local formatting so capture sources+ inherit later edits; real overrides and named character styles remain.+ - **2026-10-15** · Redefine paragraph and character styles from local formatting, including the+ Styles panel context menu, global updates and one-step undo.+ - **2026-10-15** · Paragraph Styles marks local character overrides and offers Clear Overrides+ in the style row menu; named character styles and equal local values are not false overrides.+ - **2026-10-15** · Existing paragraph and character styles preview their attribute edits in+ Style Options; Cancel restores the document and OK records one edit.+ - **2026-10-15** · Paragraph Style Options summarizes captured and pending color, size and+ paragraph settings relative to the Based On style.+ - **2026-10-15** · Typography uses named panel groups with the Control panel and restores that+ arrangement on Reset Workspace, leaving the page clear until a panel is opened. No readiness percentage change.+ - **2026-10-15** · Character panel: dragging a variable font axis slider previews on the page and is one undo step when let go (with several axes it piled up an undo step per frame); each axis takes a typed value, and narrow axes (Skia's 0.48–3.2) step by hundredths instead of jumping to whole numbers. The fields line up in two columns, auto leading shows in parentheses, and an axis-set style shows its axes. New `edit.preview` / `edit.commitPreview` / `edit.cancelPreview` commands give panels, the control channel and MCP live previews. No readiness percentage change.+ - **2026-10-15** · Selection tool: once a frame's content is selected (double-click, or the content grabber), the pointer is a hand over it and a drag anywhere on it moves the content inside the frame (Shift keeps one axis), as in InDesign; it moved the frame unless the press was on the grabber. No readiness percentage change.+ - **2026-10-15** · Scaling a text frame (Cmd+Shift-dragging a handle, the Scale tool, Transform panel scale fields) sets its text larger or smaller and leaves the frame at 100%, as InDesign's default When Scaling: Apply to Content does; it used to keep the text's size with the scale on the frame. No readiness percentage change.+ - **2026-10-15** · With nothing selected, the Tools panel's fill and stroke (the Color Picker, swatches, Apply None, Swap, Default) set the colours new shapes are drawn with, as InDesign's document defaults; the proxy shows them. They were refused ("nothing selected").+ - **2026-10-15** · The Eyedropper with text selected picks up the formatting of the text it clicks (character style and overrides, paragraph style and overrides) and applies it to the selection, as InDesign's does; it copied the clicked frame's fill and stroke instead. No readiness percentage change.+ - **2026-10-15** · A0, A1 and A2 poster presets are available in New Document, Document Setup, Properties, the Page tool and the Pages panel's size menu, as well as `file.new` and `layout.pageSize`. No readiness percentage change.+ - **2026-10-15** · Define Lists… is listed under Type › Bulleted & Numbered Lists in command search and Edit › Menus, matching the menu, and the parity doc no longer lists a Type › Paragraph Rules… menu item that does not exist. No readiness percentage change.+ - **2026-10-15** · Pressing Enter in the Layers panel's rename field without typing leaves an unnamed object unnamed, so it keeps following its automatic label instead of taking it as a fixed name. No readiness percentage change.+ - **2026-10-15** · Apply Gradient (.) with the Stroke box in front puts a new default gradient on the stroke in one undo step and leaves the fill's swatch and tint as they were. No readiness percentage change.+ - **2026-10-15** · In a facing-pages document, two odd-numbered pages in a row after a section restart (page 2 starting at 1) each get their own spread and stay right pages, instead of sharing a spread with an odd page on the left. No readiness percentage change.+ - **2026-10-15** · Character formatting set at a caret on a blank line (an empty paragraph) applies to the line's paragraph mark and to the text typed there, also after the caret has left the line and come back; typed text used to take the previous paragraph's format. No readiness percentage change.+ - **2026-10-15** · Very wide effects stay sharp at high zoom: a wide Basic Feather draws the object itself at full resolution, with only the soft mask at a reduced one, and wide inner shadows, inner glows, satin and bevels are clipped to the shape at full resolution, so they no longer blur the object or bleed past its edge. No readiness percentage change.+ - **2026-10-15** · The Typography panel controls every OpenType feature a character format carries: Other Features lists Proportional Metrics, Horizontal Kana, Localized Forms, Mark Positioning, Justification Alternates and Roman Italics. Lining, Oldstyle, Tabular or Proportional chosen alone also sets the other figure axis, so IDML export keeps the figure style instead of writing Default. Standard Ligatures follows and sets Character › Ligatures. No readiness percentage change.+ - **2026-10-15** · Join Path and Convert Point leave a path on a locked layer or inside a locked group unchanged, as the other path edits do. No readiness percentage change.+ - **2026-10-15** · A kerning value chosen in the Character panel or Properties at a caret kerns the pair at the caret (the character before it takes the value, in one undo step), and the field shows that pair's kerning; at the start of a story or paragraph it is kept for the next typing, and a selection is kerned as before (`type.kernPair`). No readiness percentage change.+ - **2026-10-15** · Japanese, Chinese and Korean input methods type into stories with the Type tool: the marked text shows in place, underlined (the clause being converted twice), with the candidate window at the caret, and the commit is one undo step. Keys, shortcuts, the clipboard and Undo wait while the input method composes; a click, a tool switch or another command keeps the marked text as typed. Not yet checked by hand with a system input method. No readiness percentage change.+ - **2026-10-15** · IDML placed PDFs keep their page and Crop to box (`PDFAttribute` `PageNumber` and `PDFCrop`, written for every placed PDF); two crops of one PDF page stay two assets; a page the PDF lacks is left out of PDF export with a warning instead of failing it; `$ID/` font names resolve; the IDML in a package links the images in its Links folder without embedding them. No readiness percentage change.+ - **2026-10-15** · The CJK leading model and character alignment take effect only in paragraphs set with a Japanese composer (`HL Composer J`, `HL Single J`), which IDML import and export keep: Western and Arabic paragraphs set baseline to baseline on the Roman baseline, a paragraph switched to a Japanese composer gets the file's Aki Below spacing, and under Aki Below a line's leading is the space below it. No readiness percentage change.+ - **2026-10-15** · Document pages follow their parent page's margins and columns unless margins were set on the page itself (`Page::local_margins`): applying a different parent gives a page that parent's margins, a page that changes side after an insert takes the other parent page's, and a page given margins equal to its parent's keeps them when the parent changes. IDML import and older files mark pages whose margins differ from their parent as their own. No readiness percentage change.+ - **2026-10-15** · Start-up picks the GPU that drives the display (or the kind `WGPU_POWER_PREF` or the adapter `WGPU_ADAPTER_NAME` names), and when a start-up fails or hangs it restarts on the next adapter, then the next backend, then a software renderer, keeping recovered documents; start-up errors are logged to standard error and the log file (#273, #334). No readiness percentage change.+ - **2026-10-15** · IDML: liquid guides keep their type on document and parent pages instead of reopening as ordinary ruler guides. Positions, orientation, Fit to Page, locks and layers are preserved; object liquid constraints remain unmapped (#872). No readiness percentage change.+ - **2026-10-15** · Table ▸ Convert Rows ▸ To Header / To Body / To Footer, as in InDesign: the selected rows become header rows when they touch the top of the table or its header rows, footer rows when they touch the bottom or its footer rows, and header or footer rows next to the body go back to body rows. The items are greyed out when the rows can't change (a gap, the last body row, a merged cell across the new boundary); one undo step. No readiness percentage change.+ - **2026-10-15** · Table of Contents: each included style can set a character style for its page number and for the text between entry and number, and Sort Entries in Alphabetical Order lists its entries alphabetically among their siblings, each with the entries under it (#1069). Both survive Update Table of Contents, renaming or deleting the character style, and IDML (`PageNumberStyle`, `SeparatorStyle`, `Sort`). No readiness percentage change.+ - **2026-10-15** · Measures in inches show four decimals, as InDesign's fields do (A4 is 8.2677 × 11.6929 in, a 1p0 gutter 0.1667 in); other units keep three.+ - **2026-10-15** · Ruler menus as InDesign's: right-clicking where the rulers meet sets the units of both; each ruler's menu lists InDesign's units and Hide Rulers, the horizontal one Delete All Guides on Spread.+ - **2026-10-15** · Properties › Edit Page works as InDesign's: the Page tool on the page in view, and Properties shows that page alone (Page Size: page, preset, orientation, W/H; Margins and Columns; Quick Actions) with Back. It opened Document Setup, which changes every page.+ - **2026-10-15** · Deleting pages that contain objects asks first, as InDesign does ("The affected page contains objects. Delete the page anyway?", with Don't show again), from the Pages panel, Layout › Pages › Delete Page and Properties.+ - **2026-10-15** · A page scrolled or jumped to shows its paper while its render is on its way, as in InDesign, instead of the black of its shadow.+ - **2026-10-15** · Tab, Shift+Tab and Presentation hide the icon column's panel flyout and the classic floating panels too, as InDesign hides floating panels.+ - **2026-10-15** · Layers panel: an object's row is renamed with a slow double-click (a second click on the selected row), as in InDesign; a quick double-click only selects it.+ - **2026-10-15** · New Workspace is InDesign's: Name, and Capture › Panel Locations and Menu Customization (the items hidden with Edit › Menus), both on by default; a workspace saved without panel locations leaves the panels where they are. No readiness percentage change.+ - **2026-10-15** · Presentation shows one spread at a time, as large as the screen allows; the arrow keys, Page Up/Down, Home, End, a click and Shift-click go through the spreads.+ - **2026-10-15** · Layout › First Page, Previous Page, Next Page, Last Page, Next Spread and Previous Spread, with InDesign's shortcuts (Shift+Page Up/Down, Shift+Cmd+Page Up/Down, Alt+Page Up/Down).+ - **2026-10-15** · A panel tab's context menu (and the end of its panel menu) has InDesign's Close, Close Tab Group, Minimize and Collapse to Icons, before Float Panel and Group with; `window.panel.closeGroup` and `window.collapseToIcons` are commands. No readiness percentage change.+ - **2026-10-15** · Window › Styles › Paragraph Styles (or Character Styles) opens InDesign's floating Character Styles | Paragraph Styles group, which stays open while other panels open; it was a flyout that the next panel replaced. No readiness percentage change.+ - **2026-10-15** · Double-clicking the status bar's preflight count or its light shows the Preflight panel, as in InDesign.+ - **2026-10-15** · A tool group's flyout closes on Esc and on a click anywhere outside it (a panel, the Fill swatch), as InDesign's; it only closed on a click on the canvas.+ - **2026-10-15** · Pages panel › Panel Options…, as InDesign's: page and parent sizes from Extra Small to Jumbo, Show Thumbnails, parents shown vertically or side by side, Pages or Parents on Top, and how the two parts share a resize; in the panel menu, the page menu and the right-click menu on the panel's empty part.+ - **2026-10-15** · The Pages panel is laid out as InDesign's: parents and pages scroll on their own, a divider between them shows more or fewer parents, and the footer (page count, Edit page size, Create new page, Delete) stays at the bottom. It scrolled away with the pages.- **2026-10-15** · IDML: ruler guides import and export (they were dropped). Each page's guides come in measured from the document's ruler origin (spread, page or spine), with Fit to Page, Locked and their layer, parent pages' included, and go out again under their pages. No readiness percentage change.- **2026-10-15** · Find Font no longer reports a style missing when it differs from the installed one only in spacing or case (InDesign files can name `Regular ` with a trailing space); the text was already drawn in the right face. No readiness percentage change.- **2026-10-15** · A line of text is set when its baseline fits in the frame, as in InDesign: descenders may hang below the frame's bottom. A frame sized to the cap height of a big heading (103 pt in a 2.77 cm frame, as Zero2Graphic's magazine tutorial draws them) no longer oversets. No readiness percentage change.diff --cc crates/engine/src/tests.rsindex 3c07d2421,9aacf469d..4b85de383--- a/crates/engine/src/tests.rs+++ b/crates/engine/src/tests.rs@@@ -1152,3 -1650,3 +1650,45 @@@ fn a_line_fits_when_its_baseline_does(assert!(!overset(&mut s, 78.5), "the line is set; its descenders hang below the frame");assert!(overset(&mut s, 50.0), "a baseline below the frame still oversets the line");}++++#[test]++fn direct_selection_pulls_one_corner_of_an_unselected_frame() {++ // Chris Nielsen's "The Adobe InDesign Toolbox" (10:10): with the White Arrow, click outside,++ // then press on a frame's corner and pull it: only that corner moves (a triangle, nearly).++ use designcraft_tools::{PointerEvent, PointerKind, SnapView};++ let mut s = Session::new();++ s.execute("file.new", &json!({"width": 612, "height": 792, "facingPages": false})).unwrap();++ let id = s.execute("frame.create", &json!({"rect": [156, 219, 455, 569], "content": "graphic"})).unwrap()["id"].as_u64().unwrap();++ s.execute("edit.deselectAll", &json!({})).unwrap();++ let corners = |s: &Session| {++ let d = &s.doc().unwrap().doc;++ let it = d.item(designcraft_doc::ItemId(id)).unwrap();++ it.path.subpaths[0].anchors.iter().map(|a| it.xf * a.p).collect::<Vec<_>>()++ };++ let before = corners(&s);++ s.set_tool("directSelection");++ let v = ViewInfo { snap: SnapView::OFF, ..ViewInfo::at_zoom(1.0) };++ let layout = s.layout();++ let at = |x: f64, y: f64| layout.to_canvas(designcraft_doc::SpreadRef::Doc(0), designcraft_geom::Point::new(x, y));++ let (a, b) = (at(455.0, 219.0), at(455.0, 150.0));++ s.pointer(&PointerEvent::new(PointerKind::Down, a.x, a.y), v).unwrap();++ s.pointer(&PointerEvent::new(PointerKind::Drag, a.x, a.y - 30.0), v).unwrap();++ s.pointer(&PointerEvent::new(PointerKind::Drag, b.x, b.y), v).unwrap();++ s.pointer(&PointerEvent::new(PointerKind::Up, b.x, b.y), v).unwrap();++ let after = corners(&s);++ let moved: Vec<_> = before.iter().zip(&after).filter(|(p, q)| (**p - **q).hypot() > 1e-6).collect();++ assert_eq!(moved.len(), 1, "one corner moved: {before:?} → {after:?}");++ assert!((*moved[0].1 - designcraft_geom::Point::new(455.0, 150.0)).hypot() < 1e-6, "{after:?}");++ assert_eq!(s.doc().unwrap().selection.items, [designcraft_doc::ItemId(id)], "the frame is selected");++ // One undo step puts the corner back.++ s.execute("edit.undo", &json!({})).unwrap();++ assert_eq!(corners(&s), before);++ // Away from its corners, the White Arrow still drags the whole unselected frame.++ s.execute("edit.deselectAll", &json!({})).unwrap();++ let (c, d) = (at(300.0, 219.0), at(300.0, 269.0));++ s.pointer(&PointerEvent::new(PointerKind::Down, c.x, c.y), v).unwrap();++ s.pointer(&PointerEvent::new(PointerKind::Drag, c.x, c.y + 20.0), v).unwrap();++ s.pointer(&PointerEvent::new(PointerKind::Drag, d.x, d.y), v).unwrap();++ s.pointer(&PointerEvent::new(PointerKind::Up, d.x, d.y), v).unwrap();++ assert!(corners(&s).iter().zip(&before).all(|(p, q)| (p.y - q.y - 50.0).abs() < 1e-6), "{:?}", corners(&s));++}diff --cc crates/tools/src/select.rsindex 1517aabd9,891f1d4ab..f8033b9bf--- a/crates/tools/src/select.rs+++ b/crates/tools/src/select.rs@@@ -500,19 -712,31 +712,44 @@@ impl Tool for SelectionToolself.drag = Drag::Anchor { id, si, ai, handle, start: p, at };return vec![Action::Begin(if handle.is_some() { "Move Direction Handle".into() } else { "Move Anchor".into() })];}+ // As in InDesign, the Direct Selection tool pressed on a corner or anchor of an object+ // that isn't selected selects it and moves just that point (Chris Nielsen's "The+ // InDesign Toolbox", 10:10: click outside, then pull a frame's corner).+ if self.direct+ && !ev.mods.shift+ && let Some((_, hit)) = cx.hit(p)+ && !cx.selection.contains(hit)+ && let Some((id, si, ai, None)) = anchor_at_in(cx, &[hit], p)+ {+ let at = anchor_spread_point(cx, id, si, ai);+ self.drag = Drag::Anchor { id, si, ai, handle: None, start: p, at };+ return vec![Action::Exec("selection.set".into(), json!({"ids": [id], "content": true})), Action::Begin("Move Anchor".into())];+ }+ // A selected placed graphic's own handles resize it inside its frame (the+ // frame's anchors, under Direct Selection, come first).+ if let Some((id, h)) = content_handle_at(cx, p)+ && let (Some(loc), Some((_, b))) = (cx.doc.find(id), selected_graphic(cx))+ {+ let turns = cx.layout.slot(loc.spread).map_or(0, |s| s.rotation as usize);+ let handle = (h + 8 - 2 * turns) % 8;+ let from = cx.layout.xf(loc.spread).inverse().transform_rect_bbox(b);+ self.drag = Drag::ContentResize { id, handle, from, spread: loc.spread };+ return vec![Action::Begin("Resize Content".into())];+ }+ if let Some((frame, corner)) = self.diamond_at(cx, p) {+ if ev.mods.alt {+ self.drag = Drag::None;+ let opts = frame.cycled(corner, ev.mods.shift);+ return vec![Action::Exec("object.cornerOptions".into(), corners::params(frame.id, &opts))];+ }+ self.drag = Drag::Corner { frame, corner, start: p };+ return vec![Action::Begin("Corner Options".into())];+ }+ if let Some(frame) = self.widget_at(cx, p) {+ self.live = Some(frame.id);+ self.drag = Drag::None;+ return vec![Action::Handled];+ }if !self.direct&& handle_at(cx, p).is_none()&& let Some(center) = rotate_zone(cx, p)