Color Effects: screen print marks follow copied artboards and clear center targets

- Copies of an artboard's marks made by Duplicate Artboards, Alt-drag and
  paste in the same document now belong to the new artboard, so marking
  either artboard replaces only its own group.
- Lines that would cross the top or bottom target on their side move in
  past it, unless that would cross another target or leave the artboard.
- null is refused for every param except time, instead of falling back to
  the default.
- The no-op check looks up each existing group's artboard once.
- docs/mcp.md says that marks outside the artboard appear in an export or
  print clipped to the artboard only as far as its bleed reaches.
This commit is contained in:
dotCooCoo committed 2026-12-01 13:11:52 -08:00
1 parent 793458e3fd
commit 3c60bf4d6a
7 files changed
+256 -34

No files matched your search

+1
View File
@@ -16,6 +16,7 @@ mod shapes;
mod typetools;
mod units;
pub(crate) use color::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};
pub(crate) use packaging::{role_swatch_edited, role_swatches_merged};
@@ -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), artboard?: index (default: the active artboard), allArtboards?: false} 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. 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), 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. 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
)]
@@ -45,7 +45,7 @@ const MAX_INKS: usize = 256;
fn number(p: &Value, key: &str, default: f64, range: std::ops::RangeInclusive<f64>) -> Result<f64> {
match p.get(key) {
None | Some(Value::Null) => Ok(default),
None => Ok(default),
Some(v) => v
.as_f64()
.filter(|n| n.is_finite() && range.contains(n))
@@ -64,7 +64,7 @@ fn choice(p: &Value, key: &str, options: [&'static str; 2], default: &'static st
/// The target positions `p` asks for, in [`POSITIONS`] order.
fn positions(p: &Value) -> Result<Vec<&'static str>> {
let asked: Vec<&str> = match p.get("positions") {
None | Some(Value::Null) => return Ok(POSITIONS.into_iter().filter(|w| DEFAULT_POSITIONS.contains(w)).collect()),
None => return Ok(POSITIONS.into_iter().filter(|w| DEFAULT_POSITIONS.contains(w)).collect()),
Some(Value::Array(a)) => {
a.iter().map(|v| v.as_str().ok_or_else(|| bad(COMMAND, "`positions` must be a list of position names"))).collect::<Result<_>>()?
}
@@ -162,8 +162,8 @@ impl Marks {
}
/// A point type line of `runs` placed with its box's top-left (or top-right) corner at `at`, or
/// its bottom corner there when `from_bottom`.
fn line(&self, runs: &[(String, Paint)], at: Point, from_bottom: bool) -> (TextObject, f64) {
/// its bottom corner there when `from_bottom`, with its box.
fn line(&self, runs: &[(String, Paint)], at: Point, from_bottom: bool) -> (TextObject, Rect) {
let runs: Vec<TextRun> = runs
.iter()
.map(|(text, fill)| {
@@ -182,7 +182,28 @@ impl Marks {
let dx = if self.left { at.x - b.x0 } else { at.x - b.x1 };
let dy = if from_bottom { at.y - b.y1 } else { at.y - b.y0 };
t.xf = Affine::translate((dx, dy));
(t, b.height())
(t, Rect::new(b.x0 + dx, b.y0 + dy, b.x1 + dx, b.y1 + dy))
}
/// The lines placed in a column from `y`, at `x`: down from `y` at the top, up
/// from it at the bottom. Each with its box.
fn column(&self, x: f64, mut y: f64) -> Vec<(TextObject, Rect)> {
let gap = self.style.size * 0.25;
let mut placed = Vec::with_capacity(self.lines.len());
if self.top {
for runs in &self.lines {
let (t, b) = self.line(runs, Point::new(x, y), false);
y += b.height() + gap;
placed.push((t, b));
}
} else {
for runs in self.lines.iter().rev() {
let (t, b) = self.line(runs, Point::new(x, y), true);
y -= b.height() + gap;
placed.insert(0, (t, b));
}
}
placed
}
/// The marks of artboard `r` (id `board`) as one group, with ids from `alloc` (the group's last).
@@ -198,24 +219,29 @@ impl Marks {
};
let skip = if self.positions.contains(&corner) { self.size + self.style.size } else { 0.0 };
let x = if self.left { r.x0 + self.inset + skip } else { r.x1 - self.inset - skip };
let gap = self.style.size * 0.25;
let mut placed = Vec::with_capacity(self.lines.len());
if self.top {
let mut y = r.y0 + self.inset;
for runs in &self.lines {
let (t, h) = self.line(runs, Point::new(x, y), false);
y += h + gap;
placed.push(t);
}
} else {
let mut y = r.y1 - self.inset;
for runs in self.lines.iter().rev() {
let (t, h) = self.line(runs, Point::new(x, y), true);
y -= h + gap;
placed.insert(0, t);
let (edge, sign) = if self.top { (r.y0, 1.0) } else { (r.y1, -1.0) };
let mut placed = self.column(x, edge + sign * self.inset);
// Lines that would cross the center target on their side move in past it, unless they
// would then cross another target or leave the artboard.
let side = if self.top { "top" } else { "bottom" };
// A target's paint: its two bars and the box of its ring, each with half the stroke weight.
let (half, ring, w2) = (self.size / 2.0, self.size / 4.0 + self.weight / 2.0, self.weight / 2.0);
let crosses = |placed: &[(TextObject, Rect)], w: &str| {
let c = self.center(r, w);
let paint = [
Rect::new(c.x - half - w2, c.y - w2, c.x + half + w2, c.y + w2),
Rect::new(c.x - w2, c.y - half - w2, c.x + w2, c.y + half + w2),
Rect::new(c.x - ring, c.y - ring, c.x + ring, c.y + ring),
];
placed.iter().any(|(_, b)| paint.iter().any(|p| b.x0 < p.x1 && b.x1 > p.x0 && b.y0 < p.y1 && b.y1 > p.y0))
};
if self.positions.contains(&side) && crosses(&placed, side) {
let moved = self.column(x, edge + sign * (self.inset + self.size + self.weight / 2.0 + self.style.size * 0.25));
if moved.iter().all(|(_, b)| b.y0 >= r.y0 && b.y1 <= r.y1) && !self.positions.iter().any(|w| crosses(&moved, w)) {
placed = moved;
}
}
children.extend(placed.into_iter().map(|t| Arc::new(Node::new(alloc(), NodeKind::Text(Box::new(t))))));
children.extend(placed.into_iter().map(|(t, _)| Arc::new(Node::new(alloc(), NodeKind::Text(Box::new(t))))));
}
let mut g = Node::group(alloc(), children);
g.name = Some(LAYER_NAME.into());
@@ -234,6 +260,29 @@ fn tag(n: &Node) -> Option<&str> {
n.extras().attrs.as_deref()?.data.iter().find(|(k, _)| k == KEY).map(|(_, v)| v.as_str())
}
/// The id of the artboard marks group `n` belongs to, from its data.
fn owner(n: &Node) -> Option<u32> {
tag(n)?.parse().ok()
}
/// Make copy `n` of an artboard's marks group belong to the artboard copied with it: its data
/// names artboard `from`, and from now on names `to`. Duplicate Artboards, Alt-drag and paste call
/// it on each copy they make. → whether `n` was such a group.
pub(crate) fn retag(n: &mut Node, from: u32, to: u32) -> bool {
if owner(n) != Some(from) {
return false;
}
let (from, to) = (from.to_string(), to.to_string());
n.edit_attrs(|a| {
for (k, v) in a.data.iter_mut() {
if k == KEY && *v == from {
v.clone_from(&to);
}
}
});
true
}
/// `n` with every object's id 0: marks drawn again compare equal to marks drawn the same way.
fn without_ids(n: &Node) -> Node {
let mut n = n.clone();
@@ -260,6 +309,10 @@ fn screen_marks(s: &mut Session, p: &Value) -> Result<Value> {
let all = switch_or(p, "allArtboards", false, C)?;
let given_time = date_param(p, "time", C)?;
let ink_name = text_param(p, "ink", C)?.unwrap_or(REGISTRATION).to_string();
// Defaults are for values left out; only `time` takes null (no date).
if let Some((key, _)) = p.as_object().and_then(|o| o.iter().find(|(k, v)| v.is_null() && *k != "time")) {
return Err(bad(C, format!("`{key}` must not be null: leave it out for the default")));
}
let artboard = index_opt(p, "artboard", C)?;
if all && artboard.is_some() {
return Err(bad(C, "give `artboard` or `allArtboards`, not both"));
@@ -333,14 +386,24 @@ fn screen_marks(s: &mut Session, p: &Value) -> Result<Value> {
if drawn.iter().any(|g| g.children().is_some_and(|kids| kids.iter().any(|k| beyond(k)))) {
return Err(bad(C, format!("the marks would reach past the edge of the canvas (±{MAX_COORD} pt)")));
}
if let Some((layer, kids)) = &layer {
let old = |board: u32| kids.iter().filter(|k| tag(k) == Some(board.to_string().as_str())).collect::<Vec<_>>();
let same = boards.iter().zip(&drawn).all(|((_, board), new)| matches!(old(*board).as_slice(), [one] if without_ids(one) == *new));
// Each existing group under the artboard it belongs to, worked out once.
let mut owned: std::collections::HashMap<u32, Vec<&Arc<Node>>> = std::collections::HashMap::new();
for k in layer.iter().flat_map(|(_, kids)| kids) {
if let Some(board) = owner(k) {
owned.entry(board).or_default().push(k);
}
}
if let Some((layer, _)) = &layer {
let same = boards
.iter()
.zip(&drawn)
.all(|((_, board), new)| matches!(owned.get(board).map(Vec::as_slice), Some([one]) if without_ids(one) == without_ids(new)));
if same {
let ids: Vec<u64> = boards.iter().filter_map(|(_, board)| old(*board).first().map(|g| g.id.0)).collect();
let ids: Vec<u64> = boards.iter().filter_map(|(_, board)| owned.get(board).and_then(|g| g.first()).map(|g| g.id.0)).collect();
return Ok(json!({ "changed": false, "layer": layer.0, "ids": ids, "inks": names }));
}
}
let owned: std::collections::HashMap<u32, Vec<NodeId>> = owned.into_iter().map(|(b, g)| (b, g.into_iter().map(|k| k.id).collect())).collect();
let (layer, ids) = s.edit("Create Screen Print Marks", |d, sel| {
let layer = match marks_layer(d).map(|l| l.id) {
Some(id) => id,
@@ -356,9 +419,8 @@ fn screen_marks(s: &mut Session, p: &Value) -> Result<Value> {
};
let mut ids = Vec::with_capacity(boards.len());
for (r, board) in &boards {
let board_tag = board.to_string();
let kids = d.children(Some(layer)).cloned().unwrap_or_default();
let old: Vec<NodeId> = kids.iter().filter(|k| tag(k) == Some(board_tag.as_str())).map(|k| k.id).collect();
let old: Vec<NodeId> = owned.get(board).cloned().unwrap_or_default();
let at = kids.iter().position(|k| old.first() == Some(&k.id)).unwrap_or(usize::MAX);
// Only what the selection holds of the marks leaves it; the rest of the selection stays as it is.
let mut held = vec![];
@@ -156,6 +156,21 @@ fn a_second_run_replaces_the_marks_and_an_unchanged_run_adds_no_undo_step() {
assert!(doc.node(NodeId(first["ids"][0].as_u64().unwrap())).is_none(), "the earlier group is gone");
}
#[test]
fn widening_an_artboard_without_changing_the_marks_adds_no_undo_step() {
let mut s = session();
let p = json!({"positions": ["topLeft"]});
let first = run(&mut s, p.clone());
let before = node(&s, first["ids"][0].as_u64().unwrap());
s.execute("artboard.setProps", &json!({"index": 0, "width": 800})).unwrap();
let undo = undo_len(&s);
let again = run(&mut s, p);
assert_eq!(again["changed"], json!(false));
assert_eq!(again["ids"], first["ids"], "the same group stays");
assert!(node(&s, again["ids"][0].as_u64().unwrap()) == before, "the existing group stays unchanged");
assert_eq!(undo_len(&s), undo, "unchanged marks add no undo step after a resize");
}
#[test]
fn replacing_the_marks_keeps_a_selected_slice_selected() {
let mut s = session();
@@ -266,6 +281,126 @@ fn lines_at_the_top_right_start_past_a_corner_target() {
assert!(close(lines(&g)[0].runs[0].style.size, 12.0));
}
#[test]
fn lines_move_up_past_a_bottom_center_target_they_would_cross() {
let mut s = session();
let p = json!({"positions": ["bottom"], "info": true, "time": 1772600760, "textSize": 72});
let r = run(&mut s, p);
let g = node(&s, r["ids"][0].as_u64().unwrap());
let doc = &s.doc().unwrap().doc;
let text = g.children().unwrap().iter().find(|n| matches!(n.kind, NodeKind::Text(_))).map(|n| doc.bounds_of(&[n.id], false).unwrap()).unwrap();
let target = targets(&g)[0].iter().map(bounds).reduce(|a, b| a.union(b)).unwrap();
assert!(text.x0 < target.x1 && text.x1 > target.x0, "the line is long enough to reach the target: {text:?} {target:?}");
assert!(text.y1 <= target.y0, "the line sits above the bottom target: {text:?} {target:?}");
}
#[test]
fn lines_do_not_move_above_a_short_artboard_to_clear_a_bottom_target() {
let mut s = session();
s.execute("artboard.setProps", &json!({"index": 0, "width": 100, "height": 56})).unwrap();
let p = json!({"positions": [], "info": true, "time": 1772600760});
let original = run(&mut s, p.clone());
let original_bounds = bounds(&node(&s, original["ids"][0].as_u64().unwrap()));
let mut with_target = p;
with_target["positions"] = json!(["bottom"]);
let r = run(&mut s, with_target);
let g = node(&s, r["ids"][0].as_u64().unwrap());
let text = g.children().unwrap().iter().find(|n| matches!(n.kind, NodeKind::Text(_))).map(|n| bounds(n)).unwrap();
let target = targets(&g)[0].iter().map(bounds).reduce(|a, b| a.union(b)).unwrap();
assert!(text.x0 < target.x1 && text.x1 > target.x0, "the file line reaches the bottom target: {text:?} {target:?}");
assert!(text.y0 >= 0.0 && text.y1 <= 56.0, "the line stays vertically inside the artboard: {text:?}");
assert_eq!(text, original_bounds, "the line keeps its original placement when shifting would leave the artboard");
}
#[test]
fn lines_do_not_move_onto_the_opposite_target_on_a_short_artboard() {
let mut s = session();
s.execute("artboard.new", &json!({"x": 700, "y": 0, "width": 600, "height": 110})).unwrap();
let p = json!({"artboard": 1, "positions": ["top", "bottom"], "info": true, "time": 1772600760, "textSize": 24});
let r = run(&mut s, p);
let g = node(&s, r["ids"][0].as_u64().unwrap());
let doc = &s.doc().unwrap().doc;
let text = g.children().unwrap().iter().find(|n| matches!(n.kind, NodeKind::Text(_))).map(|n| doc.bounds_of(&[n.id], false).unwrap()).unwrap();
let top = targets(&g)[0].iter().map(bounds).reduce(|a, b| a.union(b)).unwrap();
assert!(text.x1 <= top.x0 || text.y0 >= top.y1, "the line stays off the top target: {text:?} {top:?}");
}
#[test]
fn marks_copied_with_a_duplicated_artboard_belong_to_the_copy() {
let mut s = session();
run(&mut s, json!({}));
s.execute("artboard.duplicate", &json!({"index": 0, "art": true, "lockedAndHidden": true})).unwrap();
let kids = |s: &Session| s.doc().unwrap().doc.layers[0].children().unwrap().len();
assert_eq!(kids(&s), 2, "the duplicate carries a copy of the marks");
let copy = run(&mut s, json!({"artboard": 1, "size": 30}));
assert_eq!(kids(&s), 2, "marking the duplicate replaces the copy");
let source = run(&mut s, json!({}));
assert_eq!(source["changed"], json!(false), "the source artboard's marks are unchanged");
assert_eq!(kids(&s), 2);
assert!(s.doc().unwrap().doc.node(NodeId(copy["ids"][0].as_u64().unwrap())).is_some(), "the duplicate's marks stay");
}
#[test]
fn marks_copied_with_a_pasted_artboard_belong_to_the_pasted_one() {
let mut s = session();
let r = run(&mut s, json!({}));
s.execute("layer.setProps", &json!({"id": r["layer"], "locked": false})).unwrap();
s.execute("artboard.copy", &json!({"index": 0, "art": true, "lockedAndHidden": true})).unwrap();
s.execute("edit.paste", &json!({})).unwrap();
assert_eq!(s.doc().unwrap().doc.artboards.len(), 2);
let kids = |s: &Session| s.doc().unwrap().doc.layers.iter().map(|l| l.children().map_or(0, |k| k.len())).sum::<usize>();
let before = kids(&s);
run(&mut s, json!({"artboard": 1, "size": 30}));
assert_eq!(kids(&s), before, "marking the pasted artboard replaces the pasted copy");
let source = run(&mut s, json!({}));
assert_eq!(source["changed"], json!(false), "the source artboard's marks are unchanged");
}
#[test]
fn marks_copied_with_a_duplicated_artboard_stay_with_the_copy_after_a_resize() {
let mut s = session();
run(&mut s, json!({}));
s.execute("artboard.duplicate", &json!({"index": 0, "art": true, "lockedAndHidden": true})).unwrap();
s.execute("artboard.setProps", &json!({"index": 1, "width": 500})).unwrap();
let kids = |s: &Session| s.doc().unwrap().doc.layers[0].children().unwrap().len();
let source = run(&mut s, json!({}));
assert_eq!(source["changed"], json!(false), "the copy's marks are not the source's");
assert_eq!(kids(&s), 2);
run(&mut s, json!({"artboard": 1}));
assert_eq!(kids(&s), 2, "marking the resized duplicate replaces the copy");
}
#[test]
fn shrinking_an_artboard_keeps_its_marks_when_a_new_artboard_covers_more_of_the_stored_rectangle() {
let mut s = session();
let original = run(&mut s, json!({}));
let id = original["ids"][0].as_u64().unwrap();
let before = node(&s, id);
s.execute("artboard.setProps", &json!({"index": 0, "width": 100})).unwrap();
s.execute("artboard.new", &json!({"x": 120, "y": 0, "width": 480, "height": 400})).unwrap();
run(&mut s, json!({"artboard": 1}));
assert!(s.doc().unwrap().doc.node(NodeId(id)).is_some(), "marking the new artboard keeps the original group");
assert!(node(&s, id) == before, "the original group's art and metadata stay unchanged");
assert_eq!(s.doc().unwrap().doc.layers[0].children().unwrap().len(), 2);
run(&mut s, json!({"artboard": 0}));
assert!(s.doc().unwrap().doc.node(NodeId(id)).is_none(), "marking the resized source replaces its old group");
assert_eq!(s.doc().unwrap().doc.layers[0].children().unwrap().len(), 2);
}
#[test]
fn marks_that_reach_onto_the_next_artboard_stay_with_their_own() {
let mut s = session();
s.execute("artboard.new", &json!({"x": 620, "y": 0, "width": 600, "height": 400})).unwrap();
let r = run(&mut s, json!({"allArtboards": true, "positions": ["right"], "inset": -60}));
let ids = r["ids"].as_array().unwrap();
assert_eq!(ids.len(), 2);
for id in ids {
assert!(s.doc().unwrap().doc.node(NodeId(id.as_u64().unwrap())).is_some(), "group {id} is kept");
}
let again = run(&mut s, json!({"allArtboards": true, "positions": ["right"], "inset": -60}));
assert_eq!(again["changed"], json!(false));
}
#[test]
fn bad_params_are_refused_and_leave_the_document_unchanged() {
let mut s = session();
@@ -293,6 +428,9 @@ fn bad_params_are_refused_and_leave_the_document_unchanged() {
json!({"artboard": 5}),
json!({"artboard": -1}),
json!({"artboard": 0, "allArtboards": true}),
json!({"positions": null}),
json!({"artboard": null}),
json!({"size": null}),
json!({"positions": [], "inks": false, "info": false}),
json!({"positions": [], "inks": true}),
] {
+14 -2
View File
@@ -1664,10 +1664,17 @@ fn paste_clip(s: &mut Session, p: &Value, mode: PasteMode, clip: &Clipboard, cho
let mut imported = clip.import_into(d, choices, same_doc)?;
// Draw Inside: the clip group of the object drawn into, made on the first paste.
let into = inside.map(|t| super::create::draw_inside_group(d, t)).transpose()?;
let artboards: Vec<usize> = boards
let made_boards: Vec<(u32, usize)> = boards
.into_iter()
.flat_map(|(all, dv)| all.iter().map(move |a| (a, dv)))
.map(|(a, dv)| super::panelcmds::push_artboard_copy(d, a, a.rect + dv))
.map(|(a, dv)| (a.id, super::panelcmds::push_artboard_copy(d, a, a.rect + dv)))
.collect();
let artboards: Vec<usize> = made_boards.iter().map(|(_, i)| *i).collect();
// Screen print marks copied with an artboard pasted once belong to the pasted artboard.
let board_ids: Vec<(u32, u32)> = made_boards
.iter()
.filter(|(src, _)| made_boards.iter().filter(|(s, _)| s == src).count() == 1)
.filter_map(|(src, i)| d.artboards.get(*i).map(|a| (*src, a.id)))
.collect();
// The layers made for remembered layers the document lacks, by parent and name.
let mut made = HashMap::new();
@@ -1685,6 +1692,11 @@ fn paste_clip(s: &mut Session, p: &Value, mode: PasteMode, clip: &Clipboard, cho
// A pasted symbol set packs from the density recorded for it at Copy.
d.carry_set_densities(n, &c, &clip.set_densities);
imported.apply(&mut c, d);
for (from, to) in &board_ids {
if super::addons::retag_screen_marks(&mut c, *from, *to) {
break;
}
}
let sc = vectorcraft_doc::Scaling { patterns: mode == PasteMode::Drag, ..Default::default() };
if xf != Affine::IDENTITY {
// A cross-document drag carries the graphic's appearance with it,
+5
View File
@@ -397,7 +397,12 @@ pub(crate) fn copy_artboard(d: &mut vectorcraft_doc::Document, i: usize, dv: Vec
if let Some(id) = d.artboards.get(index).map(|a| a.id) {
d.copy_artboard_guides(src.id, id, dv);
}
let to = d.artboards.get(index).map(|a| a.id);
let copies = super::edit::copy_above(d, art, |_, _, c| {
// A copy of the artboard's screen print marks belongs to the copy.
if let Some(to) = to {
let _ = super::addons::retag_screen_marks(c, src.id, to);
}
c.transform(Affine::translate(dv), sc);
super::object::keep_pixel_aligned(c, sc);
})?;
+7 -3
View File
@@ -17789,15 +17789,19 @@ screen printing inside an artboard as document art, so they print, separate and
leaves the date out.
- `textSize` is the lines' type size, 4…72 pt (9). `textPlace` is `"top"` or `"bottom"` (the default) and
`textAlign` is `"left"` (the default) or `"right"`: the lines sit `inset` in from that edge and side, the spot ink
line above the file line, and start past a target ticked in that corner.
line above the file line, and start past a target ticked in that corner. When a line would cross the `top` or
`bottom` target on its side, the lines move in past that target. They stay where they are when moving would cross
another target or leave the artboard.
The marks of each artboard are one group, on the top-level layer "Screen Print Marks". When the document has no such
layer, the command makes it at the bottom of the stack, locked. A 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;
giving both is an error. Running the command again replaces that artboard's group and leaves the other artboards'
groups alone. It is one undo step, and none when the marks come out the same (`changed: false`). The selection is
groups alone. A group copied with an artboard duplicated, Alt-dragged or pasted in the same document belongs to the copy. 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
kept. An unknown position or one named twice, a number out of range, an `ink` that is not [Registration] or a spot
swatch, a value of the wrong type, nothing to draw (no position, no file line, and no spot ink line or no spot ink to
swatch, a value of the wrong type (`null` included, except for `time`), nothing to draw (no position, no file line, and no spot ink line or no spot ink to
name), and marks that would reach more than 4,000,000 pt from the origin are errors that leave the document unchanged. The dialog previews on the canvas, and its OK is off while nothing is ticked.
→ `{changed, layer, ids: [group id…], inks: [spot ink name…]}`
+1 -1
View File
@@ -3290,7 +3290,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. 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. 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).
## Stroke Weight Up and Down shortcuts (2026-11-06)