Screen print marks: artboard moves and cuts take marks by their owner

Moving an artboard with its art now takes its own screen print marks
group by the artboard recorded on it, even when the group lies outside
every artboard, and leaves another artboard's group that lies on it.
Cut already did; the duplicate code path for it is removed.

Tests cover duplicate, Alt-drag, copy and cut of overlapping artboards
and of marks outside the artboard, and moves with and without
Move Locked and Hidden Artwork.
This commit is contained in:
dotCooCoo committed 2026-12-02 06:35:21 -08:00
1 parent de593ec64f
commit 3d5c51b689
5 files changed
+116 -14

No files matched your search

@@ -488,6 +488,111 @@ fn marks_lying_on_another_copied_artboard_go_with_their_own_artboards_copy() {
assert_eq!(run(&mut s, p)["changed"], json!(false), "the first artboard's marks are unchanged");
}
/// `target` (`index` or `indices`) with the parameters each artboard copy command takes: an
/// Alt-drag for `artboard.move`, and the artboards' art for the others.
fn copy_params(command: &str, target: Value) -> Value {
let mut p = match command {
"artboard.move" => json!({"moveArt": true, "copy": true, "dy": 500, "lockedAndHidden": true}),
_ => json!({"art": true, "lockedAndHidden": true}),
};
if let (Some(p), Some(t)) = (p.as_object_mut(), target.as_object()) {
p.extend(t.clone());
}
p
}
#[test]
fn overlapping_artboard_copies_keep_one_marks_group_per_owner() {
for command in ["artboard.duplicate", "artboard.move", "artboard.copy"] {
let mut s = session();
s.execute("artboard.new", &json!({"x": 300, "y": 0, "width": 600, "height": 400})).unwrap();
let first = run(&mut s, json!({"artboard": 0, "positions": ["right"]}));
let second = run(&mut s, json!({"artboard": 1, "positions": ["left"]}));
let before = s.doc().unwrap().doc.clone();
let originals = [node(&s, first["ids"][0].as_u64().unwrap()), node(&s, second["ids"][0].as_u64().unwrap())];
let p = copy_params(command, json!({"indices": [0, 1]}));
s.execute(command, &p).unwrap();
if command == "artboard.copy" {
s.execute("edit.paste", &json!({})).unwrap();
}
let d = &s.doc().unwrap().doc;
let groups = d.layers[0].children().unwrap();
assert_eq!(groups.len(), 4, "{command}");
for (source, original) in originals.iter().enumerate() {
assert!(d.node(original.id).unwrap() == original, "{command}");
let copied_board = &d.artboards[source + 2];
let copies: Vec<_> = groups.iter().filter(|g| super::owner(g) == Some(copied_board.id)).collect();
assert_eq!(copies.len(), 1, "{command}: owner {source}");
let offset = copied_board.rect.origin() - d.artboards[source].rect.origin();
assert_eq!(bounds(copies[0]), bounds(original) + offset, "{command}: owner {source}");
}
s.execute("edit.undo", &json!({})).unwrap();
assert!(s.doc().unwrap().doc == before, "{command}: one undo restores both artboards and marks");
}
}
#[test]
fn off_board_marks_follow_artboard_copies_and_cuts_by_owner() {
for command in ["artboard.duplicate", "artboard.move", "artboard.copy", "artboard.cut"] {
let mut s = session();
s.execute("artboard.new", &json!({"x": 700, "y": 0, "width": 600, "height": 400})).unwrap();
let r = run(&mut s, json!({"artboard": 0, "positions": ["top"], "inset": -200}));
let original = node(&s, r["ids"][0].as_u64().unwrap());
let other = run(&mut s, json!({"artboard": 1, "positions": ["left"], "inset": -200}));
let foreign = node(&s, other["ids"][0].as_u64().unwrap());
assert!(bounds(&original).y1 < 0.0);
assert!(s.doc().unwrap().doc.artboards[0].rect.contains_rect(bounds(&foreign)));
let before = s.doc().unwrap().doc.clone();
let p = copy_params(command, json!({"index": 0}));
let reply = s.execute(command, &p).unwrap();
if command == "artboard.cut" {
assert_eq!(reply["copied"], json!(1));
assert!(s.doc().unwrap().doc.node(original.id).is_none());
}
if matches!(command, "artboard.copy" | "artboard.cut") {
s.execute("edit.paste", &json!({})).unwrap();
}
let d = &s.doc().unwrap().doc;
let copied_board = d.artboards.last().unwrap();
let copies: Vec<_> = d.layers[0].children().unwrap().iter().filter(|g| super::owner(g) == Some(copied_board.id)).collect();
assert_eq!(copies.len(), 1, "{command}");
assert!(d.node(foreign.id).unwrap() == &foreign, "{command}: another artboard's marks stay unchanged");
let offset = copied_board.rect.origin() - before.artboards[0].rect.origin();
assert_eq!(bounds(copies[0]), bounds(&original) + offset, "{command}");
s.execute("edit.undo", &json!({})).unwrap();
if command == "artboard.cut" {
s.execute("edit.undo", &json!({})).unwrap();
}
assert!(s.doc().unwrap().doc == before, "{command}");
}
}
#[test]
fn moving_an_artboard_uses_marks_ownership_instead_of_containment() {
let mut s = session();
s.execute("artboard.new", &json!({"x": 700, "y": 0, "width": 600, "height": 400})).unwrap();
let outside = run(&mut s, json!({"artboard": 0, "positions": ["top"], "inset": -200}));
let other = run(&mut s, json!({"artboard": 1, "positions": ["left"], "inset": -200}));
let own = node(&s, outside["ids"][0].as_u64().unwrap());
let foreign = node(&s, other["ids"][0].as_u64().unwrap());
assert!(bounds(&own).y1 < 0.0);
assert!(s.doc().unwrap().doc.artboards[0].rect.contains_rect(bounds(&foreign)));
let before = s.doc().unwrap().doc.clone();
for (move_art, all) in [(false, true), (true, false)] {
s.execute("artboard.move", &json!({"index": 0, "dy": 500, "moveArt": move_art, "lockedAndHidden": all})).unwrap();
assert!(node(&s, own.id.0) == own);
assert!(node(&s, foreign.id.0) == foreign);
s.execute("edit.undo", &json!({})).unwrap();
assert!(s.doc().unwrap().doc == before);
}
s.execute("artboard.move", &json!({"index": 0, "dy": 500, "moveArt": true, "lockedAndHidden": true})).unwrap();
assert_eq!(bounds(&node(&s, own.id.0)), bounds(&own) + vectorcraft_geom::Vec2::new(0.0, 500.0));
assert!(node(&s, foreign.id.0) == foreign);
assert_eq!(super::owner(&node(&s, own.id.0)), super::owner(&own));
s.execute("edit.undo", &json!({})).unwrap();
assert!(s.doc().unwrap().doc == before);
}
#[test]
fn marks_lying_on_another_artboard_go_with_their_own_artboards_copy_alone() {
let mut s = session();
+5 -10
View File
@@ -38,7 +38,7 @@ pub fn specs() -> Vec<CommandSpec> {
"Cut Artboard",
[],
None,
"{index? | indices?, selectedArtboards?, art?, lockedAndHidden?} put the artboards and the art fully inside each on the clipboard (leaving oversized or overhanging art on the canvas and off the clipboard), then delete the artboards and that art in one undo step (one artboard is always left: the cut fails when it names every artboard, or a locked one; art also on another locked artboard stays, and is left off the clipboard, unless lockedAndHidden); edit.cut runs this while the Artboard tool is chosen → {copied: objects}",
"{index? | indices?, selectedArtboards?, art?, lockedAndHidden?} put the artboards and the art fully inside each on the clipboard (leaving oversized or overhanging art on the canvas and off the clipboard), then delete the artboards and that art in one undo step (one artboard is always left: the cut fails when it names every artboard, or a locked one; art also on another locked artboard stays, and is left off the clipboard, unless lockedAndHidden). With art, screen print marks go with their recorded owner artboard even outside its bounds, subject to lockedAndHidden; edit.cut runs this while the Artboard tool is chosen → {copied: objects}",
has_doc,
|s, p| {
boards_and_art_noted(s, p, "artboard.cut")?;
@@ -309,7 +309,7 @@ pub(crate) fn artboard_art(s: &Session, i: usize, art: bool, all: bool, moving:
/// `arts` (artboard indices with their art) with each artboard's screen print marks group in its
/// own artboard's entry: another artboard's group lying on one of them goes with its own artboard
/// when that one is among `arts`, and is left out when it is not. Only the groups on the marks
/// layer count; a group whose artboard was deleted stays where it is. Copies and cuts of artboards.
/// layer count; a group whose artboard was deleted stays where it is.
pub(crate) fn marks_with_owners(d: &vectorcraft_doc::Document, arts: Vec<(usize, Vec<NodeId>)>) -> Vec<(usize, Vec<NodeId>)> {
let owners = super::addons::screen_marks_owners(d);
if owners.is_empty() {
@@ -343,18 +343,15 @@ pub(crate) fn marks_with_owners(d: &vectorcraft_doc::Document, arts: Vec<(usize,
}
/// Each of `indices` with the art that goes with it when `art` ([`artboard_art`]), an object
/// counted once, with the first of them it is on (artboards can overlap). A copy also takes each
/// copied artboard's own screen print marks group, wherever the group lies.
/// counted once, with the first of them it is on (artboards can overlap). With `art`, each
/// artboard takes its own eligible screen print marks group, wherever the group lies.
pub(crate) fn artboards_art(s: &Session, indices: &[usize], art: bool, all: bool, moving: bool) -> Result<Vec<(usize, Vec<NodeId>)>> {
let mut seen = std::collections::HashSet::new();
let mut arts = vec![];
for &i in indices {
let art = artboard_art(s, i, art, all, moving)?.into_iter().filter(|id| seen.insert(*id)).collect();
let art: Vec<NodeId> = artboard_art(s, i, art, all, moving)?.into_iter().filter(|id| seen.insert(*id)).collect();
arts.push((i, art));
}
if moving {
return Ok(arts);
}
let d = &s.doc()?.doc;
if art {
for (id, o) in super::addons::screen_marks_copied(d, all) {
@@ -418,8 +415,6 @@ pub(crate) fn artboard_copy(s: &mut Session, p: &Value, cut: bool) -> Result<Val
if cut {
refuse_locked(&st.doc, &indices)?;
}
// A cut leaves the screen print marks of an artboard it does not take where they are.
let arts = if cut { marks_with_owners(&st.doc, arts) } else { arts };
let art = st.doc.paint_order(arts.into_iter().flat_map(|(_, a)| a));
let boards: Vec<_> = indices.iter().filter_map(|i| st.doc.artboards.get(*i).cloned()).collect();
let clip = Clipboard { source_artboard: boards.first().map(|a| a.rect), artboards: boards, ..Clipboard::copy(st, &art, false) };
+2 -3
View File
@@ -49,7 +49,7 @@ pub fn specs() -> Vec<CommandSpec> {
"Move Artboard",
[],
None,
"{index | indices: [index…], dx, dy, moveArt?: bool, copy?: bool, patterns?: bool (Transform Patterns: pattern fills and strokes transform with the art; default: prefs transformPatternTiles), lockedAndHidden?: bool (default: prefs moveLockedWithArtboard)} move artboards (and the art fully inside them; locked and hidden art, and art also on another locked artboard, only with lockedAndHidden), several in one step (an error when one is locked); `copy` (Alt-drag) leaves them and moves copies, which start unlocked → {index (the first), indices: the artboards moved or the copies, moved: the art moved or the copies}",
"{index | indices: [index…], dx, dy, moveArt?: bool, copy?: bool, patterns?: bool (Transform Patterns: pattern fills and strokes transform with the art; default: prefs transformPatternTiles), lockedAndHidden?: bool (default: prefs moveLockedWithArtboard)} move artboards (and the art fully inside them; locked and hidden art, and art also on another locked artboard, only with lockedAndHidden), several in one step (an error when one is locked); `copy` (Alt-drag) leaves them and moves copies, which start unlocked. With moveArt, screen print marks go with their recorded owner artboard even outside its bounds, subject to lockedAndHidden → {index (the first), indices: the artboards moved or the copies, moved: the art moved or the copies}",
has_doc,
artboard_move
),
@@ -685,8 +685,7 @@ fn artboard_move(s: &mut Session, p: &Value) -> Result<Value> {
if !copy {
super::panelcmds::refuse_locked(&s.doc()?.doc, &indices)?;
}
// Each artboard's art, an object counted once (artboards can overlap). A copy also takes each
// copied artboard's screen print marks group, wherever the group lies.
// Each artboard takes its art once and its own eligible screen print marks group.
let arts = super::panelcmds::artboards_art(s, &indices, move_art, locked_art, !copy)?;
let ids: Vec<NodeId> = arts.iter().flat_map(|(_, a)| a.iter().copied()).collect();
let sc = Scaling { patterns: super::object::transform_patterns(s, p, &ids)?, ..Scaling::default() };
+2 -1
View File
@@ -17919,7 +17919,8 @@ giving both is an error. Running the command again replaces that artboard's grou
groups alone. A group copied with an artboard duplicated, Alt-dragged or pasted in the same document belongs to the copy.
Another artboard's group lying on an artboard that is duplicated, Alt-dragged, copied or cut goes with its own artboard:
it is copied with that artboard when that one is copied too, and otherwise stays where it is. A group whose artboard was
deleted is copied like other art. When the "Screen Print Marks" layer was
deleted is copied like other art. With art enabled, moves and cuts also take marks by their recorded owner, even when
the marks lie outside every artboard, subject to `lockedAndHidden`. When the "Screen Print Marks" layer was
deleted, pasting an artboard with its marks makes the layer again, and the command uses that layer. Marks
outside the artboard (a negative `inset`) appear in an export or a print clipped to the artboard only as far as its
bleed reaches. It is one undo step, and none when the marks come out the same (`changed: false`). The selection is
+2
View File
@@ -3303,6 +3303,8 @@ A VectorCraft addition (it replaces a script some users ran), so no area score m
A VectorCraft addition, so no area score moves. Object › Plug-ins › Color Effects › Create Screen Print Marks… (`addon.color.screenMarks`) opens a dialog (the eight target positions, size, stroke weight, inset, ink, the spot ink and file lines with their type size, place and alignment, all artboards, with a preview) and draws registration targets (a circle half the target's width with a cross through it) inside the artboard in [Registration] or a spot ink, with an optional line naming the document's spot inks, each in its own ink, and an optional line with the file name and the date and time in UTC. The marks are document art: one group per artboard on a locked "Screen Print Marks" layer made at the bottom of the stack, so they print, separate and export with the rest of the art, where Create Trim Marks draws trim marks only and the PDF export's printer's marks exist only in the exported file. The lines move in past a top or bottom target they would cross. They stay where they are when moving would cross another target or leave the artboard. Marks copied with a duplicated artboard belong to the copy, and another artboard's marks lying on a copied artboard stay with their own artboard. A paste that makes the deleted marks layer again makes it the marks layer. Running it again replaces that artboard's marks; one undo step, none when the marks come out the same. Remaining: saved presets of the dialog's settings. Tests: `cmd::addons::color::screen_marks::tests` (engine), `addons::color::screen_marks::tests` (ui-egui).
With art enabled, artboard moves and cuts take eligible screen print marks by their recorded owner, including marks outside every artboard. Tests: `overlapping_artboard_copies_keep_one_marks_group_per_owner`, `off_board_marks_follow_artboard_copies_and_cuts_by_owner`, `moving_an_artboard_uses_marks_ownership_instead_of_containment` in `cmd::addons::color::screen_marks::tests`.
## Stroke Weight Up and Down shortcuts (2026-11-06)
Cmd/Ctrl+Alt+. (`stroke.weightUp`) and Cmd/Ctrl+Alt+, (`stroke.weightDown`) raise and lower the weight of each selected stroke from its own weight, with the keys a [public feature request reply](https://illustrator.uservoice.com/forums/333657-illustrator-desktop-feature-requests/suggestions/32307397-increment-decrement-stroke-weight-key-commands) names: a quarter unit of Units › Stroke at a time up to one unit, whole units above it, no lower than a quarter unit and no higher than 1000 pt. Type steps its stroked characters; objects without a stroke are left alone; with nothing selected the weight of the next object drawn steps. Each press is one undo step (#5797). Evidence: `tests::strokeux::stroke_weight_up_and_down_step_each_selected_stroke`, `stroke_weight_up_with_nothing_selected_sets_up_new_art`, `cmd::stroke::tests::weight_steps_follow_units_and_stop_at_their_bounds`. Scores unchanged.