Screen print marks: artboard deletes, position moves and replays keep marks with their owner

Deleting an artboard now clears the owner tag of its marks group, on the
marks layer or moved off it, so a reopened file that gives a new artboard
the old id does not hand it the old marks. artboard.setProps with moveArt
and a new x or y takes the artboard's own marks group wherever it lies and
leaves another artboard's group lying on it, as artboard.move does; an
artboard scaled in the same call leaves a moving artboard's marks alone,
and marks lying on another locked artboard stay unless lockedAndHidden.
A run on the active artboard records it in the journal as activeArtboard,
which recorded actions leave out.
This commit is contained in:
dotCooCoo committed 2026-12-04 17:32:34 -08:00
1 parent e91a7fe0fe
commit c99020bf0b
8 files changed
+206 -19

No files matched your search

+1 -1
View File
@@ -18,7 +18,7 @@ mod units;
pub(crate) use color::screen_marks::{
LAYER_NAME as SCREEN_MARKS_LAYER, adopt_layer as adopt_screen_marks_layer, copied_owners as screen_marks_copied, layer_id as screen_marks_layer,
managed_owners as screen_marks_owners, owned_by as screen_marks_of, retag as retag_screen_marks,
managed_owners as screen_marks_owners, owned_by as screen_marks_of, release as release_screen_marks, retag as retag_screen_marks,
};
pub(crate) use image::{DecodedImages, refresh_color_masks};
pub use packaging::{FoldAngles, fold_source, print_hidden, selection_fold_angles, selection_fold_lines};
@@ -23,7 +23,7 @@ pub fn specs() -> Vec<CommandSpec> {
"Create Screen Print Marks",
["Object", "Plug-ins", "Color Effects"],
None,
"{positions?: [topLeft|top|topRight|left|right|bottomLeft|bottom|bottomRight…] (each at most once; default: [top, bottom, left, right]; [] draws no targets), size?: target width in pt 4..1000 (36), weight?: stroke weight in pt 0.1..20 (1), inset?: pt from the artboard's edge to the target's outer edge -1000..1000 (18; below 0 the targets sit outside the artboard), ink?: \"[Registration]\" (default) or a spot swatch's name (the targets and the file line), inks?: false (a line naming the document's spot inks, each name in its own ink; tints and [Registration] left out), info?: false (a line with the file name, or the title of a document never saved, and the date and time in UTC), time?: Unix seconds (default: now; null, or no clock as on the web: no date), textSize?: pt 4..72 (9), textPlace?: \"top\"|\"bottom\" (default), textAlign?: \"left\" (default)|\"right\" (the lines start past a target ticked in that corner, and move in past the top or bottom target they would cross; they stay where they are when moving would cross another target or leave the artboard), artboard?: index (default: the active artboard), allArtboards?: false; null is refused except for time} draw registration targets (a circle half the target's width with a cross through it, stroked) inside each artboard, and the lines asked for, as one group per artboard on the layer \"Screen Print Marks\", which is made locked at the bottom of the stack when there is none; running it again replaces that artboard's group. Another artboard's group lying on a copied artboard goes with its own artboard. One undo step, none when the marks come out the same; the selection is kept → {changed, layer, ids: [group id…], inks: [spot ink name…]}",
"{positions?: [topLeft|top|topRight|left|right|bottomLeft|bottom|bottomRight…] (each at most once; default: [top, bottom, left, right]; [] draws no targets), size?: target width in pt 4..1000 (36), weight?: stroke weight in pt 0.1..20 (1), inset?: pt from the artboard's edge to the target's outer edge -1000..1000 (18; below 0 the targets sit outside the artboard), ink?: \"[Registration]\" (default) or a spot swatch's name (the targets and the file line), inks?: false (a line naming the document's spot inks, each name in its own ink; tints and [Registration] left out), info?: false (a line with the file name, or the title of a document never saved, and the date and time in UTC), time?: Unix seconds (default: now; null, or no clock as on the web: no date), textSize?: pt 4..72 (9), textPlace?: \"top\"|\"bottom\" (default), textAlign?: \"left\" (default)|\"right\" (the lines start past a target ticked in that corner, and move in past the top or bottom target they would cross; they stay where they are when moving would cross another target or leave the artboard), artboard?: index (default: the active artboard), activeArtboard?: index (the active artboard the journal records for a replay; used when artboard is left out; omitted from recorded actions), allArtboards?: false; null is refused except for time} draw registration targets (a circle half the target's width with a cross through it, stroked) inside each artboard, and the lines asked for, as one group per artboard on the layer \"Screen Print Marks\", which is made locked at the bottom of the stack when there is none; running it again replaces that artboard's group. Another artboard's group lying on a copied artboard goes with its own artboard. One undo step, none when the marks come out the same; the selection is kept → {changed, layer, ids: [group id…], inks: [spot ink name…]}",
has_doc,
screen_marks
)]
@@ -307,6 +307,25 @@ pub(crate) fn retag(n: &mut Node, from: u32, to: u32) -> bool {
true
}
/// Make the marks groups of the deleted artboards with ids `gone` ordinary art: a file opened
/// again can give a new artboard one of those ids, and its marks are drawn afresh.
pub(crate) fn release(d: &mut Document, gone: &std::collections::HashSet<u32>) {
// Groups moved off the marks layer keep their tag and count too.
let mut groups: Vec<NodeId> = vec![];
for l in &d.layers {
l.walk(&mut |n: &Node| {
if owner(n).is_some_and(|o| gone.contains(&o)) {
groups.push(n.id);
}
});
}
for id in groups {
if let Some(n) = d.node_mut(id) {
n.edit_attrs(|a| a.data.retain(|(k, _)| k != KEY));
}
}
}
/// Make top-level layer `layer`, which a paste made for a marks group it copied with an artboard,
/// the marks layer, when the document has none.
pub(crate) fn adopt_layer(d: &mut Document, layer: NodeId) {
@@ -352,6 +371,22 @@ fn screen_marks(s: &mut Session, p: &Value) -> Result<Value> {
if all && artboard.is_some() {
return Err(bad(C, "give `artboard` or `allArtboards`, not both"));
}
// The active artboard, noted in the journal (`activeArtboard`) so a replay marks the same one;
// recorded actions leave it out and use the active artboard when played.
let recorded = index_opt(p, "activeArtboard", C)?;
let artboard = match artboard {
None if !all => {
let i = match recorded {
Some(i) => Some(i),
None => active_artboard(s.doc()?),
};
if let Some(i) = i {
s.note_journal("activeArtboard", json!(i));
}
i
}
given => given,
};
let st = s.doc()?;
let doc = &st.doc;
if doc.artboards.is_empty() {
@@ -360,10 +395,7 @@ fn screen_marks(s: &mut Session, p: &Value) -> Result<Value> {
let boards: Vec<(Rect, u32)> = if all {
doc.artboards.iter().map(|a| (a.rect, a.id)).collect()
} else {
let i = match artboard {
Some(i) => i,
None => active_artboard(st).unwrap_or(0),
};
let i = artboard.unwrap_or(0);
let a = doc.artboards.get(i).ok_or_else(|| bad(C, format!("there is no artboard {i}")))?;
vec![(a.rect, a.id)]
};
@@ -812,3 +812,122 @@ fn bad_params_are_refused_and_leave_the_document_unchanged() {
assert_eq!(r["inks"], json!([]));
assert!(lines(&node(&s, r["ids"][0].as_u64().unwrap())).is_empty());
}
#[test]
fn marks_of_a_deleted_artboard_belong_to_no_artboard_that_later_takes_its_id() {
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": 1, "positions": ["right"]}));
let gone = s.doc().unwrap().doc.artboards[1].id;
s.execute("artboard.delete", &json!({"indices": [1]})).unwrap();
assert!(s.doc().unwrap().doc.node(NodeId(r["ids"][0].as_u64().unwrap())).is_some(), "the marks stay as art");
// A reopened file does not remember the deleted id, so a new artboard can take it.
assert!(!super::managed_owners(&s.doc().unwrap().doc).values().any(|o| *o == gone), "no marks group names the deleted artboard");
}
#[test]
fn marks_moved_off_the_marks_layer_forget_their_deleted_artboard() {
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": 1, "positions": ["right"]}));
s.execute("layer.setProps", &json!({"id": r["layer"], "locked": false})).unwrap();
let other = s.doc().unwrap().doc.layers[1].id.0;
s.execute("layer.move", &json!({"ids": [r["ids"][0]], "target": other})).unwrap();
s.execute("artboard.delete", &json!({"indices": [1]})).unwrap();
assert_eq!(super::owner(&node(&s, r["ids"][0].as_u64().unwrap())), None);
}
#[test]
fn moving_an_artboard_leaves_its_marks_lying_on_another_locked_artboard() {
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": ["right"], "inset": -200}));
let own = node(&s, r["ids"][0].as_u64().unwrap());
s.execute("layer.setProps", &json!({"id": r["layer"], "locked": false})).unwrap();
s.execute("artboard.setProps", &json!({"index": 1, "locked": true})).unwrap();
s.execute("artboard.move", &json!({"index": 0, "dy": 500, "moveArt": true, "lockedAndHidden": false})).unwrap();
assert!(node(&s, own.id.0) == own, "Move Artboard leaves them on the locked artboard");
s.execute("edit.undo", &json!({})).unwrap();
s.execute("artboard.setProps", &json!({"index": 0, "y": 500, "moveArt": true, "lockedAndHidden": false})).unwrap();
assert!(node(&s, own.id.0) == own, "a new position leaves them on the locked artboard");
}
#[test]
fn an_artboard_scaled_in_the_same_call_leaves_a_moving_artboards_marks_to_it() {
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": ["right"], "inset": -200}));
let start = bounds(&node(&s, r["ids"][0].as_u64().unwrap()));
let edits = json!([{"index": 1, "width": 1200}, {"index": 0, "y": 500}]);
s.execute("artboard.setProps", &json!({"artboards": edits, "scaleArt": true, "moveArt": true, "lockedAndHidden": true})).unwrap();
let moved = bounds(&node(&s, r["ids"][0].as_u64().unwrap()));
assert_eq!((moved.x0, moved.y0, moved.width()), (start.x0, start.y0 + 500.0, start.width()), "the marks move with their own artboard, unscaled");
}
#[test]
fn marks_on_an_artboard_unlocked_in_the_same_call_stay_when_their_own_artboard_moves() {
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": ["right"], "inset": -200}));
let own = node(&s, r["ids"][0].as_u64().unwrap());
s.execute("layer.setProps", &json!({"id": r["layer"], "locked": false})).unwrap();
s.execute("artboard.setProps", &json!({"index": 1, "locked": true})).unwrap();
let edits = json!([{"index": 0, "y": 500}, {"index": 1, "locked": false, "y": 500}]);
s.execute("artboard.setProps", &json!({"artboards": edits, "moveArt": true, "lockedAndHidden": false})).unwrap();
assert!(node(&s, own.id.0) == own, "the marks lay on a locked artboard when the call began");
s.execute("edit.undo", &json!({})).unwrap();
let edits = json!([{"index": 0, "y": 500}, {"index": 1, "locked": false, "width": 1200}]);
s.execute("artboard.setProps", &json!({"artboards": edits, "scaleArt": true, "moveArt": true, "lockedAndHidden": false})).unwrap();
assert!(node(&s, own.id.0) == own, "the artboard scaled in the same call leaves them too");
}
#[test]
fn a_marks_group_of_a_missing_artboard_goes_with_the_first_listed_artboard() {
let mut s = session();
for _ in 0..2 {
s.execute("artboard.new", &json!({"x": 0, "y": 0, "width": 600, "height": 400})).unwrap();
}
let r = run(&mut s, json!({"artboard": 2, "positions": ["top"]}));
// A file saved before deleting an artboard cleared its marks' tag.
std::sync::Arc::make_mut(&mut s.doc_mut().unwrap().doc).artboards.remove(2);
let start = bounds(&node(&s, r["ids"][0].as_u64().unwrap()));
let edits = json!([{"index": 0, "width": 1200}, {"index": 1, "y": 500}]);
s.execute("artboard.setProps", &json!({"artboards": edits, "scaleArt": true, "moveArt": true, "lockedAndHidden": true})).unwrap();
let now = bounds(&node(&s, r["ids"][0].as_u64().unwrap()));
assert!(close(now.width(), start.width() * 2.0), "it scales with the first artboard listed");
}
#[test]
fn moving_an_artboard_by_its_position_takes_its_own_marks_and_leaves_others() {
let mut s = session();
s.execute("artboard.new", &json!({"x": 700, "y": 0, "width": 600, "height": 400})).unwrap();
let own = run(&mut s, json!({"artboard": 0, "positions": ["top"], "inset": -200}))["ids"][0].as_u64().unwrap();
let foreign = run(&mut s, json!({"artboard": 1, "positions": ["left"], "inset": -200}))["ids"][0].as_u64().unwrap();
let (own, foreign) = (node(&s, own), node(&s, foreign));
s.execute("artboard.setProps", &json!({"index": 0, "y": 500, "moveArt": true, "lockedAndHidden": true})).unwrap();
let start = bounds(&own);
let moved = bounds(&node(&s, own.id.0));
assert_eq!((moved.x0, moved.y0), (start.x0, start.y0 + 500.0), "the marks lying above the artboard move with it");
assert!(node(&s, foreign.id.0) == foreign, "another artboard's marks lying on it stay");
}
#[test]
fn marks_drawn_on_the_active_artboard_record_it_for_a_replay() {
let mut s = session();
s.execute("artboard.new", &json!({"x": 700, "y": 0, "width": 600, "height": 400})).unwrap();
let second = s.doc().unwrap().doc.artboards[1].id;
s.doc_mut().unwrap().active_artboard = Some(second);
let start = s.journal.len();
run(&mut s, json!({"positions": ["right"]}));
let (cmd, recorded) = s.journal.last().unwrap().clone();
assert_eq!(cmd, COMMAND);
assert_eq!(recorded["activeArtboard"], json!(1), "the journal names the artboard the marks went on");
// A replay on another active artboard marks the recorded one.
let first = s.doc().unwrap().doc.artboards[0].id;
s.doc_mut().unwrap().active_artboard = Some(first);
let replayed = run(&mut s, recorded);
assert_eq!(replayed["changed"], json!(false), "the second artboard's marks are drawn again the same");
// A recorded action leaves it out and marks the artboard active when it plays.
let action = s.journal_for_action(start);
assert!(action.iter().all(|(_, p)| p.get("activeArtboard").is_none()));
}
+23 -3
View File
@@ -165,7 +165,7 @@ pub fn specs() -> Vec<CommandSpec> {
"Artboard Options…",
["Window", "Artboards"],
None,
"{index | artboards: [{index, name?, color?, guideLabel?, locked?, showCenterMark?, showCrossHairs?, showVideoSafeAreas?, videoRulerPixelAspectRatio?, x?, y?, width?, height?}…] (several artboards in one undo step, each with its own fields; the art inside each before any of them changes goes with it, and an object inside several goes with the first listed that moves or scales its art), name?, color?: color (\"#rrggbb\", {c,m,y,k}, … as the paint commands take, #rrggbbaa and #rgba refused: the background color the canvas draws the artboard's paper in, multiplied with the Simulate Colored Paper color while that is on. Supported artboard exports and printing include it by default. This includes raster exports with `selectedOnly: true` when the output area is an artboard. Set `includeArtboardFill: false` on the export or print command to omit it. Exports cropped to selection bounds, artwork bounds, or an explicit raster region leave it out, as do formats that do not support artboard fills) | null (no background color), guideLabel?: name | \"#rrggbb\" | null (the guide label: the canvas draws the artboard's own guides (guide.add with artboard) in this color instead of the guide color preference, selected ones still in the selection color; a layer color's name spelled exactly as Layer Options lists it (\"Light Blue\", \"Red\", …) or #rrggbb; null for none, which new artboards and older files have; screen-only, so exports and print leave it out; it can change on a locked artboard; an invalid value anywhere in the list changes nothing), locked?: bool (the Artboards panel's lock column: a locked artboard keeps its rectangle (a new x, y, width or height is an error unless locked is false), can't be moved, deleted or cut, and Rearrange and Fit to Artwork Bounds leave it as it is; the art on it (each object of a layer or sublayer whose bounds with strokes overlap it, a group as one object) acts as locked art until it is unlocked: clicks, marquees, select.set, select.all and the tools pass over it (art drawn or pasted onto it stays selected and editable until a selection leaves it out or it is moved off the locked artboards), it is deselected, and when another artboard moves or scales it stays unless lockedAndHidden), showCenterMark?: bool (Artboard Options' Show Center Mark: the canvas draws a mark at the artboard's center), showCrossHairs?: bool (Show Cross Hairs: the canvas draws a line from the middle of each side through the center), showVideoSafeAreas?: bool (Show Video Safe Areas: the canvas draws the action-safe area 3.5% and the title-safe area 5% in from each edge, as EBU R 95 sets them; the three are screen-only, as the artboard's edges are: exports and print leave them out), videoRulerPixelAspectRatio?: number 0.1–10 (Video Ruler Pixel Aspect Ratio: the width of one video pixel over its height, which View › Rulers › Show Video Rulers counts the artboard in; default 1, square pixels), x?, y?, width?, height?, moveArt?: bool (default false; a position-only change moves the contained art with its artboard), scaleArt?: bool (Scale Artwork with Artboard: resized, the artboard takes the art fully inside it (locked and hidden art only with lockedAndHidden?: bool, default prefs moveLockedWithArtboard) and its guides from its old rectangle onto the new one, each side by its own ratio; strokes/corners/patterns as object.scale), strokes?: bool, corners?: bool, patterns?: bool (the three as object.scale, for art that moves or scales with the artboard), lockedAndHidden?: bool (locked and hidden art moves along; default: the preference; recorded in the journal so a replay matches)} → null, or with scaleArt {scaled: the art scaled}; no undo step when nothing changes",
"{index | artboards: [{index, name?, color?, guideLabel?, locked?, showCenterMark?, showCrossHairs?, showVideoSafeAreas?, videoRulerPixelAspectRatio?, x?, y?, width?, height?}…] (several artboards in one undo step, each with its own fields; the art inside each before any of them changes goes with it, and an object inside several goes with the first listed that moves or scales its art), name?, color?: color (\"#rrggbb\", {c,m,y,k}, … as the paint commands take, #rrggbbaa and #rgba refused: the background color the canvas draws the artboard's paper in, multiplied with the Simulate Colored Paper color while that is on. Supported artboard exports and printing include it by default. This includes raster exports with `selectedOnly: true` when the output area is an artboard. Set `includeArtboardFill: false` on the export or print command to omit it. Exports cropped to selection bounds, artwork bounds, or an explicit raster region leave it out, as do formats that do not support artboard fills) | null (no background color), guideLabel?: name | \"#rrggbb\" | null (the guide label: the canvas draws the artboard's own guides (guide.add with artboard) in this color instead of the guide color preference, selected ones still in the selection color; a layer color's name spelled exactly as Layer Options lists it (\"Light Blue\", \"Red\", …) or #rrggbb; null for none, which new artboards and older files have; screen-only, so exports and print leave it out; it can change on a locked artboard; an invalid value anywhere in the list changes nothing), locked?: bool (the Artboards panel's lock column: a locked artboard keeps its rectangle (a new x, y, width or height is an error unless locked is false), can't be moved, deleted or cut, and Rearrange and Fit to Artwork Bounds leave it as it is; the art on it (each object of a layer or sublayer whose bounds with strokes overlap it, a group as one object) acts as locked art until it is unlocked: clicks, marquees, select.set, select.all and the tools pass over it (art drawn or pasted onto it stays selected and editable until a selection leaves it out or it is moved off the locked artboards), it is deselected, and when another artboard moves or scales it stays unless lockedAndHidden), showCenterMark?: bool (Artboard Options' Show Center Mark: the canvas draws a mark at the artboard's center), showCrossHairs?: bool (Show Cross Hairs: the canvas draws a line from the middle of each side through the center), showVideoSafeAreas?: bool (Show Video Safe Areas: the canvas draws the action-safe area 3.5% and the title-safe area 5% in from each edge, as EBU R 95 sets them; the three are screen-only, as the artboard's edges are: exports and print leave them out), videoRulerPixelAspectRatio?: number 0.1–10 (Video Ruler Pixel Aspect Ratio: the width of one video pixel over its height, which View › Rulers › Show Video Rulers counts the artboard in; default 1, square pixels), x?, y?, width?, height?, moveArt?: bool (default false; a position-only change moves the contained art with its artboard, and the artboard's own screen print marks group wherever it lies, while another artboard's group lying on it stays with its own), scaleArt?: bool (Scale Artwork with Artboard: resized, the artboard takes the art fully inside it (locked and hidden art only with lockedAndHidden?: bool, default prefs moveLockedWithArtboard) and its guides from its old rectangle onto the new one, each side by its own ratio; strokes/corners/patterns as object.scale), strokes?: bool, corners?: bool, patterns?: bool (the three as object.scale, for art that moves or scales with the artboard), lockedAndHidden?: bool (locked and hidden art moves along; default: the preference; recorded in the journal so a replay matches)} → null, or with scaleArt {scaled: the art scaled}; no undo step when nothing changes",
has_doc,
artboard_set
),
@@ -1250,6 +1250,7 @@ pub(crate) fn remove_artboards(d: &mut Document, sel: &mut vectorcraft_doc::Sele
for &id in &gone {
d.retire_artboard_id(id);
}
super::addons::release_screen_marks(d, &gone);
d.retain_guides(sel, |g| !g.artboard.is_some_and(|a| gone.contains(&a)));
count_artboard_pass();
Ok(())
@@ -1393,7 +1394,6 @@ fn artboard_set(s: &mut Session, p: &Value) -> Result<Value> {
let delta = now.origin() - was.origin();
let moving = !resized && bool_or(p, "moveArt", false) && delta != vectorcraft_geom::Vec2::ZERO;
let transform = fit.or_else(|| moving.then(|| Affine::translate(delta)));
let art = if transform.is_some() { d.art_moving_with(index, all).into_iter().filter(|id| taken.insert(*id)).collect() } else { vec![] };
edits.push(ArtboardEdit {
index,
now,
@@ -1409,9 +1409,29 @@ fn artboard_set(s: &mut Session, p: &Value) -> Result<Value> {
resized,
fit,
transform,
art,
art: vec![],
});
}
// The artboards that move take their own screen print marks groups wherever they lie, and not
// another artboard's lying on them, as Move Artboard does. An artboard that scales in the same
// call leaves a moving artboard's marks lying on it to their own artboard.
// One pass for all of them, in the order listed.
let movers: Vec<usize> = edits.iter().filter(|e| e.transform.is_some() && e.fit.is_none()).map(|e| e.index).collect();
let mut found = super::panelcmds::artboards_art(s, &movers, true, all, true)?.into_iter();
let moved: Vec<Option<Vec<NodeId>>> =
edits.iter().map(|e| (e.transform.is_some() && e.fit.is_none()).then(|| found.next().map(|(_, a)| a).unwrap_or_default())).collect();
// Every group that belongs to a moving artboard, taken by it or left where it is; a group whose
// artboard was deleted is ordinary art.
let boards: HashSet<u32> = movers.iter().filter_map(|i| d.artboards.get(*i).map(|a| a.id)).collect();
let reserved: HashSet<NodeId> = super::addons::screen_marks_owners(d).into_iter().filter(|(_, o)| boards.contains(o)).map(|(id, _)| id).collect();
for (e, own) in edits.iter_mut().zip(moved) {
let art = match own {
Some(art) => art,
None if e.fit.is_some() => d.art_moving_with(e.index, all).into_iter().filter(|id| !reserved.contains(id)).collect(),
None => vec![],
};
e.art = art.into_iter().filter(|id| taken.insert(*id)).collect();
}
// Nothing to change: no undo step.
if !edits.iter().any(|e| d.artboards.get(e.index).is_none_or(|a| e.changes(a))) {
return if scale_art { Ok(json!({ "scaled": [] })) } else { ok() };
+15 -4
View File
@@ -310,7 +310,12 @@ pub(crate) fn artboard_art(s: &Session, i: usize, art: bool, all: bool, moving:
/// 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.
pub(crate) fn marks_with_owners(d: &vectorcraft_doc::Document, arts: Vec<(usize, Vec<NodeId>)>) -> Vec<(usize, Vec<NodeId>)> {
/// `held(i, id)` says group `id` stays put for artboard `i`.
pub(crate) fn marks_with_owners(
d: &vectorcraft_doc::Document,
arts: Vec<(usize, Vec<NodeId>)>,
held: impl Fn(usize, NodeId) -> bool,
) -> Vec<(usize, Vec<NodeId>)> {
let owners = super::addons::screen_marks_owners(d);
if owners.is_empty() {
return arts;
@@ -335,7 +340,9 @@ pub(crate) fn marks_with_owners(d: &vectorcraft_doc::Document, arts: Vec<(usize,
})
.collect();
for (o, id) in moved {
if let Some((_, art)) = arts.iter_mut().find(|(i, _)| board(*i) == Some(o)) {
if let Some((i, art)) = arts.iter_mut().find(|(i, _)| board(*i) == Some(o))
&& !held(*i, id)
{
art.push(id);
}
}
@@ -353,16 +360,20 @@ pub(crate) fn artboards_art(s: &Session, indices: &[usize], art: bool, all: bool
arts.push((i, art));
}
let d = &s.doc()?.doc;
// A move or a cut leaves a group lying on an artboard locked other than its own, as it leaves
// other art there, unless locked and hidden art goes too.
let held = |i: usize, id: NodeId| moving && !all && d.node(id).is_some_and(|n| d.locked_artboards_except(i).holds(n));
if art {
for (id, o) in super::addons::screen_marks_copied(d, all) {
if let Some((_, own)) = arts.iter_mut().find(|(i, _)| d.artboards.get(*i).is_some_and(|a| a.id == o))
if let Some((i, own)) = arts.iter_mut().find(|(i, _)| d.artboards.get(*i).is_some_and(|a| a.id == o))
&& !held(*i, id)
&& seen.insert(id)
{
own.push(id);
}
}
}
Ok(marks_with_owners(d, arts))
Ok(marks_with_owners(d, arts, held))
}
/// How far a copy of `rect` moves to sit right of the last artboard (Duplicate Artboards, Paste).
+2 -1
View File
@@ -37,7 +37,7 @@ pub const DRAWS_SHAPE: [&str; 5] = ["shape.rectangle", "shape.ellipse", "shape.p
/// Artboard tool had selected for its commands and for Paste in Place, in Front and in Back; the artboards and art Cut and Copy took with that
/// tool chosen; the view's center the app passes to Edit Symbol); an action leaves them out
/// ([`Session::journal_for_action`]).
const REPLAY_ONLY: [(&str, &str); 38] = [
const REPLAY_ONLY: [(&str, &str); 39] = [
("edit.copy", "artboard"),
("edit.cut", "artboard"),
("file.new", "created"),
@@ -68,6 +68,7 @@ const REPLAY_ONLY: [(&str, &str); 38] = [
("artboard.distributeSpacing", "selectedArtboards"),
("artboard.distributeSpacing", "activeArtboard"),
("addon.document.floodFillArtboards", "activeArtboard"),
("addon.color.screenMarks", "activeArtboard"),
("edit.copy", "selectedArtboards"),
("edit.copy", "art"),
("edit.cut", "selectedArtboards"),
+8 -4
View File
@@ -11745,7 +11745,9 @@ artboard size fields while the tool is in use.
`artboard.setProps {artboards: [{index, name?, color?, guideLabel?, locked?, showCenterMark?, showCrossHairs?, showVideoSafeAreas?, videoRulerPixelAspectRatio?, x?, y?, width?, height?}…], scaleArt?, moveArt?, …}` sets several
artboards in one undo step, each with its own fields; the other params apply to all of them. The art that moves or
scales with each artboard is the art inside it before any of them changes, and an object inside several of them goes
with the first one listed that moves or scales its art. An empty list and a list that names an artboard twice are
with the first one listed that moves or scales its art. An artboard whose new `x` or `y` at the same size moves its art (`moveArt`) takes its own
screen print marks group wherever it lies, and leaves another artboard's group lying on it to that artboard
([Create Screen Print Marks](#create-screen-print-marks)). An empty list and a list that names an artboard twice are
refused.
With several artboards selected with the Artboard tool, the desktop app gives a new size to each of them in one such
@@ -18525,12 +18527,14 @@ The marks of each artboard are one group, on the top-level marks layer the comma
the layer's data and not by its name. The command makes that layer, named "Screen Print Marks", at the bottom of the
stack, locked, when the document has none. Another layer with that name is not used, and the marks layer keeps its
role when renamed. A marks layer moved, unlocked or hidden stays as it is.
`artboard` is an artboard's index (default: the active artboard) and `allArtboards: true` marks every artboard;
`artboard` is an artboard's index (default: the active artboard; the journal records it as `activeArtboard` for a replay, and recorded actions leave it
out) and `allArtboards: true` marks every artboard;
giving both is an error. Running the command again replaces that artboard's group and leaves the other artboards'
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. With art enabled, moves and cuts also take marks by their recorded owner, even when
it is copied with that artboard when that one is copied too, and otherwise stays where it is. Deleting an artboard makes its group ordinary art on the marks layer, so a new artboard never takes it over;
it is copied like other art. With art enabled, moves (`artboard.move`, and `artboard.setProps` with `moveArt` and a
new `x` or `y` at the same size) and cuts also take marks by their recorded owner (marks lying on another locked artboard stay, as other art does), even when
the marks lie outside every artboard, subject to `lockedAndHidden`. When the marks layer was
deleted, or the document pasted into has none, pasting an artboard with its marks makes a new marks layer named "Screen Print Marks" at the top level, 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
+1 -1
View File
@@ -3318,7 +3318,7 @@ A VectorCraft addition (it replaces a script some users ran), so no area score m
## Create Screen Print Marks (2026-11-29)
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).
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. Moving an artboard with its art, by Move Artboard or a new position, takes its own marks, and deleting it makes its marks ordinary art. 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`.