DesignCraft: An open-source page and layout design editor written by scratch in pure Rust
Integration: #1034 the canvas draws the bleed from Spread::bleed_rect, which uses the outer pages; ROADMAP line matches the diff
aionggec3593e4f964
diff --git a/ROADMAP.md b/ROADMAP.mdindex 1d0ea8134..95a5e4b09 100644--- a/ROADMAP.md+++ b/ROADMAP.md@@ -350,6 +350,8 @@ Newest first.- **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-14** · Objects snap to the bleed guide's four sides while moving, resizing or drawing; snapping and the canvas share one bleed rectangle (`Spread::bleed_rect`). No readiness percentage change.+- **2026-10-14** · Threading keeps generated and linked stories, text that refers to a story, local IDs and locked frames intact; a colour chosen at a caret waits for the typing, Swap Fill and Stroke on text keeps each run's colours, control-channel input never reads or writes the system clipboard, and IDML frame preferences given as properties import with bounded column counts (#84). No readiness percentage change.- **2026-10-14** · The Liquid Layout panel follows InDesign's: Liquid Page Rule with the page number, Content › Auto-Fit, and Object Constraints › Resize with Page and Pin for the selected object on an object-based page; Create Alternate Layout moved to the Layout menu. No readiness percentage change.- **2026-10-14** · On an object-based page the Page tool shows a selected object's liquid pins and resize locks as InDesign does: a click pins a side to the page edge or locks the width or height, with InDesign's tooltips. No readiness percentage change.@@ -514,8 +516,6 @@ Newest first.- **2026-10-13** · Text recomposes when the document baseline grid changes, when a layer holding a text-wrap object is shown or hidden, or when a section's start number, numbering style, prefix or marker changes; the composition cache keyed only on the section count and item identities and kept the old layout. No readiness percentage change.- **2026-10-13** · Reflowable EPUB and HTML export include tables (header and footer rows, merged cells), footnotes (a linked note after the paragraph that refers to it) and endnotes (a linked section at the end of the book). No readiness percentage change.- **2026-10-13** · Word import: table cells read text by the same rules as body text, so deleted text, moved-away text and field codes stay out (#721). Word's Normal comes in as its own paragraph style "Normal" over the document defaults, so text formatted only by Normal keeps its look; it conflicts only with a document's own Normal, and the style map can send it to [Basic Paragraph] (#722). No readiness percentage change.-- **2026-10-14** · Three fixes from a real job: objects snap to the bleed guide's four sides while moving, resizing or drawing (`Spread::bleed_rect` is shared by the canvas and `snap.rs`); a selected group shows the in/out ports of the text frames inside it, so an overset frame in a group shows its red mark; the status bar's error count is a menu whose Preflight Panel… entry opens the panel. No readiness percentage change.-- **2026-10-14** · Direct Selection (A) moves a placed graphic inside its frame: `transform.move` honours the content selection (or `content: true`) and translates the graphic in the frame's inner space, also for rotated frames; the frame stays. Text frames, copies and moves to another spread move as a whole. Before, the frame moved with the graphic. No readiness percentage change.- **2026-10-12** · macOS Dock Quit uses the same unsaved-document prompts as window and menu Quit. Repeated requests keep the current answers; Cancel retains every tab and unsaved recovery checkpoint, and completed Save/Don't Save answers exit through the ordinary event loop. No readiness percentage change.- **2026-10-12** · Text strokes can sit behind the fill: the stroke lies wholly outside the letters at its full weight on screen, in PNG and in PDF, set from the Properties panel or Character Style Options. IDML `StrokeAlignment` on text imports and exports as this setting, so imported text with outside-aligned strokes keeps its letter shapes (#619). No readiness percentage change.- **2026-10-12** · Placed Word documents keep their bullets and numbering (#626): `numbering.xml` levels become bullet or numbered paragraphs with Word's number formats, label text, start numbers, restarts and list indents, also when a paragraph style carries the list. No readiness percentage change.diff --git a/crates/doc/src/page.rs b/crates/doc/src/page.rsindex 903612b5d..7a407b2ec 100644--- a/crates/doc/src/page.rs+++ b/crates/doc/src/page.rs@@ -303,9 +303,11 @@ impl Spread {}/// The bleed guide: one rectangle around the spread. `bleed` is the document's top, bottom,/// inside, outside; the inside value applies only at an outer edge on the spine side (a lone- /// left page's right edge). None without pages or without any bleed.+ /// left page's right edge). The outer edges are the leftmost and rightmost pages, whichever+ /// binding ordered the list. None without pages or without any bleed.pub fn bleed_rect(&self, bleed: [f64; 4]) -> Option<Rect> {- let (first, last) = (self.pages.first()?, self.pages.last()?);+ let (l, r) = self.outer_page_indices()?;+ let (first, last) = (self.pages.get(l)?, self.pages.get(r)?);if !bleed.iter().any(|v| *v > 0.0) {return None;}@@ -452,6 +454,23 @@ mod tests {assert_eq!(s.page_at_x(-50.0), Some(0));assert_eq!(s.page_at_x(5000.0), Some(1));}++ /// The outside bleed goes on the leftmost and rightmost pages, also when right-to-left+ /// binding lists the right page first.+ #[test]+ fn bleed_rect_uses_the_outer_pages() {+ let bleed = [1.0, 2.0, 3.0, 4.0];+ for pages in [+ vec![page(PageSide::Left, 0.0), page(PageSide::Right, 612.0)],+ vec![page(PageSide::Right, 612.0), page(PageSide::Left, 0.0)],+ ] {+ let s = Spread { id: SpreadId(1), pages, items: vec![], parent: None, allow_shuffle: true };+ assert_eq!(s.bleed_rect(bleed), Some(Rect::new(-4.0, -1.0, 1228.0, 794.0)));+ assert_eq!(s.bleed_rect([0.0; 4]), None);+ }+ let lone_left = Spread { id: SpreadId(1), pages: vec![page(PageSide::Left, 0.0)], items: vec![], parent: None, allow_shuffle: true };+ assert_eq!(lone_left.bleed_rect(bleed), Some(Rect::new(-4.0, -1.0, 615.0, 794.0)));+ }}#[cfg(test)]diff --git a/crates/ui-egui/src/canvas.rs b/crates/ui-egui/src/canvas.rsindex a2d6f0fd3..16604d001 100644--- a/crates/ui-egui/src/canvas.rs+++ b/crates/ui-egui/src/canvas.rs@@ -2,7 +2,7 @@//! selection, text ports and threads, the text caret, rulers, and pointer/keyboard input.use designcraft_compose as compose;-use designcraft_doc::{Content, Document, Item, PageSide, SpreadRef};+use designcraft_doc::{Content, Document, Item, SpreadRef};use designcraft_engine::doc::Selection;use designcraft_geom::{Affine, Point, Rect as DRect, Vec2 as DVec2};use designcraft_tools::{CanvasLayout, Cursor, Mods, Overlay, PointerEvent, PointerKind, ToolKey};@@ -882,15 +882,9 @@ fn draw_guides(app: &DesignApp, painter: &egui::Painter, xf: &Xf, doc: &Documentlet pt = |p: Point| xf.to_screen(m * p);let rect = |r: DRect| xf.rect(m.transform_rect_bbox(r));// Bleed: one rectangle around the spread (inside bleed only applies at the spread's outer edges).- let b = s.bleed;if app.ui.guides- && b.iter().any(|v| *v > 0.0)- && let Some((first, last)) = sp.outer_page_indices().and_then(|(l, r)| Some((sp.pages.get(l)?, sp.pages.get(r)?)))+ && let Some(br) = sp.bleed_rect(s.bleed){- let l = if first.side == PageSide::Left { b[3] } else { b[2] };- let r = if last.side == PageSide::Right || last.side == PageSide::Single { b[3] } else { b[2] };- let sb = sp.bounds();- let br = DRect::new(sb.x0 - l, sb.y0 - b[0], sb.x1 + r, sb.y1 + b[1]);painter.rect_stroke(rect(br), 0.0, Stroke::new(hair(painter), c32(s.bleed_color)), StrokeKind::Middle);}let pasteboard = m.inverse().transform_rect_bbox(layout.pasteboard);