L: alternate layouts keep their stories linked to the originals

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Brandon ThomasandClaude Opus 5.5 committed 2026-10-04 00:10:48 -04:00
1 parent 1c8952f6db
commit d30285c542
3 files changed
+22 -4

No files matched your search

+1 -1
View File
@@ -92,7 +92,7 @@ DesignCraft aims at full Adobe InDesign parity — and to be better: faster, ope
- Power Zoom (Hand tool: press and hold still for half a second, or Alt-press): zoom out to the spread, aim the red view rectangle, release to zoom back in there.
- Graphic cells (`table.placeGraphic`, `table.textCell`, Table › Convert Cell Type, Table panel): images in table cells, fitted or filled, clipped to the cell on screen and in PDF.
- Live Distribute (Space while dragging a selection handle; `transform.resize {distribute}`): objects keep their size and spread with the bounds.
- Liquid Layout (`liquid.pageRule/object`, `guide.liquid`, `layout.createAlternate`, Liquid Layout panel): scale / re-center / guide-based / object-based page rules applied on page resize and Document Setup; dashed liquid guides; alternate layouts as resized page copies in a named section. Alternate layouts aren't linked to their source.
- Liquid Layout (`liquid.pageRule/object`, `guide.liquid`, `layout.createAlternate`, Liquid Layout panel): scale / re-center / guide-based / object-based page rules applied on page resize and Document Setup; dashed liquid guides; alternate layouts as resized page copies in a named section. Text in an alternate layout stays linked to the original stories (Links panel shows them out of date; `story.updateLink`).
- Split Window / New Window (`window.split`, `window.newWindow`, Window ▸ Arrange): two side-by-side views of the document with their own zoom, scroll and render cache. New Window puts the second view in its own OS window (an egui viewport; a floating window on the web).
- Transparency flattener (`file.exportPdf {flatten: high|medium|low|ppi}`, Edit ▸ Transparency Flattener Presets): each object involving transparency becomes an opaque image of its area over what's beneath it, so everything else stays vector (spreads with transparent parent items are rasterised whole).
- Video and sound (place .mp4/.mov/.webm/.mp3/.wav…, `media.options/get`, Media panel): media frames show a poster or placeholder on screen, in print and in PDF, and export as HTML5 `<video>`/`<audio>` in EPUB. No in-app playback or PDF rich media.
+19 -1
View File
@@ -230,7 +230,19 @@ fn create_alternate(s: &mut crate::Session, p: &Value) -> Result<Value> {
g
})
.collect();
super::object::duplicate_from(d, &src, &ids, SpreadRef::Doc(ti), designcraft_geom::Vec2::new(to.x0 - pb.x0, 0.0))?;
let new = super::object::duplicate_from(d, &src, &ids, SpreadRef::Doc(ti), designcraft_geom::Vec2::new(to.x0 - pb.x0, 0.0))?;
// The copies' stories stay linked to the originals (Links panel: update when they change).
for (old, new) in ids.iter().zip(&new) {
let (Some(os), Some(ns)) =
(src.item(*old).and_then(|i| i.text_frame()).map(|t| t.story), d.item(*new).and_then(|i| i.text_frame()).map(|t| t.story))
else {
continue;
};
let rev = src.story(os).map_or(0, |s| s.rev);
if let Some(st) = d.story_mut(ns) {
st.link = Some((os, rev));
}
}
}
let pages: Vec<usize> = (n + 1..=2 * n).collect();
super::layout::resize_pages(d, &pages, Some(w), Some(h));
@@ -307,5 +319,11 @@ mod tests {
assert!((bounds(&s, a).width() - 200.0).abs() < 1e-6 && (bounds(&s, b).width() - 100.0).abs() < 1e-6);
s.execute("edit.undo", &json!({})).unwrap();
assert_eq!(s.doc().unwrap().doc.page_count(), 1);
// Text in an alternate layout stays linked to the original story.
s.execute("edit.redo", &json!({})).unwrap();
let t = s.execute("frame.create", &json!({"rect": [100, 300, 300, 400], "content": "text", "text": "Original", "caret": false})).unwrap();
s.execute("layout.createAlternate", &json!({"name": "Tall", "width": 600, "height": 1200})).unwrap();
let links = s.execute("story.links", &json!({})).unwrap();
assert!(links.as_array().unwrap().iter().any(|l| l["parent"] == t["story"]), "{links}");
}
}
+2 -2
View File
@@ -11,7 +11,7 @@ Each row of the InDesign feature catalogue is scored **D** (done), **P** (partia
|---|---|---|---|---|---|
| P0 | 102 | 100 | 2 | 0 | 99% |
| P1 | 97 | 96 | 1 | 0 | 99% |
| P2 | 76 | 65 | 11 | 0 | 93% |
| P2 | 76 | 66 | 10 | 0 | 93% |
| Area | Parity |
|---|---|
@@ -79,7 +79,7 @@ Open P0 items: Vector/page formats (PDF/AI/SVG/EPS place), Export to PDF (print)
| Documents, pages, spreads | Layout Adjustment | P2 | D |
| Documents, pages, spreads | Adjust Layout | P2 | D |
| Documents, pages, spreads | Liquid layout | P2 | D |
| Documents, pages, spreads | Alternate layouts | P2 | P |
| Documents, pages, spreads | Alternate layouts | P2 | D |
| Documents, pages, spreads | Document grid & baseline grid | P0 | D |
| Documents, pages, spreads | Ruler guides | P0 | D |
| Documents, pages, spreads | Guides on layers | P1 | D |