Merge pull request #10573 from dotCooCoo/fix/mark-bounds-beside-live-objects

Arrange Tools: Mark Bounds of Each puts marks beside a live object, not inside it
This commit is contained in:
.CooCoo
2026-12-03 07:27:55 -08:00
committed by GitHub
5 changed files with 321 additions and 13 deletions
+96 -10
View File
@@ -6,12 +6,12 @@
#[cfg(test)]
mod tests;
use std::collections::HashMap;
use std::collections::{HashMap, HashSet};
use std::sync::Arc;
use serde_json::{Value, json};
use vectorcraft_color::{Color, Paint};
use vectorcraft_doc::{Appearance, Document, Node, NodeId};
use vectorcraft_doc::{Appearance, Document, Node, NodeId, NodeKind};
use vectorcraft_geom::{PathData, Point, Rect, SubPath, shapes};
use vectorcraft_render::drawn_bounds_with;
@@ -36,7 +36,22 @@ pub fn specs() -> Vec<CommandSpec> {
"Mark Bounds of Each",
["Object", "Plug-ins", "Arrange Tools"],
None,
"{style?: \"corners\" (an L-shaped mark on each corner, its two legs running inward along the edges) | \"rectangle\" (a rectangle on the bounds) (\"corners\"), bounds?: \"geometric\" (strokes not counted) | \"visual\" (strokes, brush art and effects as drawn) (\"geometric\"), length?: pt 0.001..1000000 (10; corners: each leg's length, at most half the side it runs along), weight?: pt 0.01..1000 (1), color?: color (\"#ff0000\"; an RGB color takes the document's color mode)} draw marks on the bounds of each selected object (the top-level ones, at most 20000) as new art: a group of four corner marks, or one rectangle, with no fill and the stroke given, stacked directly above its object (above the outermost clip group or clipping sublayer that holds it, so the clip does not hide them). A clip group is measured by its clipping path and other groups by their members together. Guides, objects without bounds such as empty groups, and (for corners) objects whose sides are too short for any leg get no marks. The marks are selected; one undo step, and none when nothing gets marks (an error) → {ids: [the new marks…], count}",
"{style?: \"corners\" (an L-shaped mark on each corner, its two legs running inward along the edges) | \
\"rectangle\" (a rectangle on the bounds) (\"corners\"), bounds?: \"geometric\" (strokes not counted) | \
\"visual\" (strokes, brush art and effects as drawn) (\"geometric\"), length?: pt 0.001..1000000 \
(10; corners: each leg's length, at most half the side it runs along), weight?: pt 0.01..1000 (1), \
color?: color (\"#ff0000\"; an RGB color takes the document's color mode)} draw marks on the bounds of each selected object \
(the top-level ones, at most 20000) as new art: a group of four corner marks, or one rectangle, with no fill and the stroke given, \
stacked directly above its object (above the outermost clip group, clipping sublayer or live object that holds it: \
a blend, compound path, compound shape, Shaper group, Objects on Path group, Live Paint group, dimension, graph, flare, envelope, \
mesh, repeat, intertwine, Image Trace group, generated art group, graph series, graph design copy or \
clipping pieces group, so the clip does not hide them and the live object does not take them in; in isolation mode, \
marks that would go outside the isolated art are an error). Selected parts of compound paths, envelopes, meshes, repeats, \
Shaper groups and blends with a stored spine or Align to Path, and hidden Image Trace sources, are measured as the outermost \
such live object, with one set of marks per object. Other blend keys and compound shape operands keep their own bounds. \
A clip group is measured by its clipping path and other groups by their members together. Guides, objects without bounds \
such as empty groups, and (for corners) objects whose sides are too short for any leg get no marks. The marks are selected; \
one undo step, and none when nothing gets marks (an error) → {ids: [the new marks…], count}",
has_selection,
mark_bounds
)]
@@ -81,13 +96,18 @@ fn corner_paths(r: Rect, length: f64) -> Vec<PathData> {
.collect()
}
/// Where the marks of object `id` go: directly above it, or above the outermost clip group or
/// clipping sublayer that holds it at any depth, which would otherwise clip them. A top-level layer
/// with a clipping mask holds its marks too, since nothing lies outside it.
fn anchor(d: &Document, id: NodeId) -> NodeId {
/// Where the marks of object `id` go: directly above it, or above the outermost clip group,
/// clipping sublayer or live object (a blend, compound path, compound shape, Shaper group, Objects on Path group,
/// Live Paint group, dimension, graph, flare, envelope, mesh, repeat, intertwine, Image Trace group, generated art group,
/// graph series, graph design copy or clipping pieces group) that holds it at any
/// depth, which would otherwise clip them or take them in as one of its parts. A top-level layer
/// with a clipping mask holds its marks too, since nothing lies outside it. `held` keeps each
/// container's answer, so that siblings selected together look each container up once.
fn anchor(d: &Document, id: NodeId, held: &mut HashMap<NodeId, bool>) -> NodeId {
let (mut at, mut outermost) = (id, id);
while let Some(up) = d.parent_of(at) {
if d.node(up).is_some_and(|n| n.clips()) && d.parent_of(up).is_some() {
let holds = *held.entry(up).or_insert_with(|| d.node(up).is_some_and(|n| n.clips() || !plain(n)) && d.parent_of(up).is_some());
if holds {
outermost = up;
}
at = up;
@@ -95,6 +115,51 @@ fn anchor(d: &Document, id: NodeId) -> NodeId {
outermost
}
/// Whether `n` is a layer or a group with no live role, which keeps new art as an ordinary member.
fn plain(n: &Node) -> bool {
let e = n.extras();
matches!(n.kind, NodeKind::Layer { .. } | NodeKind::Group { .. })
&& !n.is_compound_shape()
&& e.shaper.is_none()
&& e.objects_on_path.is_none()
&& e.dimension.is_none()
&& e.graph.is_none()
&& e.flare.is_none()
&& e.trace.is_none()
&& e.generated.is_none()
&& e.series_index.is_none()
&& !e.graph_design_art
&& !e.clip_pieces
&& e.live_paint_gaps.is_none()
&& !vectorcraft_tools::builder::is_live_paint(n)
}
/// The outermost live object that draws a selected part with different geometry or placement.
fn measured_object(d: &Document, id: NodeId) -> NodeId {
let (mut at, mut measured) = (id, id);
while let Some(up) = d.parent_of(at) {
if let Some(n) = d.node(up) {
let redraws = match &n.kind {
NodeKind::Compound { .. } | NodeKind::Envelope { .. } | NodeKind::Mesh(_) | NodeKind::Repeat(_) => true,
NodeKind::Blend { spec, .. } => {
(spec.spine.is_some() && !spec.no_spine) || spec.orientation == vectorcraft_doc::BlendOrientation::AlignToPath
}
_ => {
n.extras().shaper.is_some()
|| (n.extras().trace.is_some()
&& n.children()
.is_some_and(|children| children.first().is_some_and(|c| c.id == at) && n.editing_children().len() < children.len()))
}
};
if redraws {
measured = up;
}
}
at = up;
}
measured
}
fn mark_bounds(s: &mut Session, p: &Value) -> Result<Value> {
const C: &str = COMMAND;
let rectangle = choice(p, C, "style", &["corners", "rectangle"])? == Some("rectangle");
@@ -106,18 +171,39 @@ fn mark_bounds(s: &mut Session, p: &Value) -> Result<Value> {
if roots.len() > MAX_OBJECTS {
return Err(bad(C, "too many objects selected (at most 20000)"));
}
let d = &s.doc()?.doc;
let st = s.doc()?;
let (d, isolation) = (&st.doc, st.isolation);
let symbols = d.symbol_boxes();
let mut marked: Vec<(NodeId, Rect)> = Vec::with_capacity(roots.len());
let mut held: HashMap<NodeId, bool> = HashMap::new();
let mut measured = HashSet::new();
let mut too_small = false;
for id in roots {
if d.node(id).is_none_or(|n| n.is_guide()) {
continue;
}
let id = measured_object(d, id);
if !measured.insert(id) {
continue;
}
let Some(n) = d.node(id).filter(|n| !n.is_guide()) else { continue };
let placed = matches!(n.kind, NodeKind::Blend { .. }).then(|| {
let mut art = vectorcraft_render::effects::expand_live_deep(Some(d), n);
art.appearance = n.appearance.clone();
art
});
let n = placed.as_ref().unwrap_or(n);
let bounds = if visual { drawn_bounds_with(&symbols, n) } else { n.geometric_bounds_with(&symbols) };
let Some(r) = bounds.filter(|r| r.width() > FLAT || r.height() > FLAT) else { continue };
// Corner legs are at most half a side, so an object too small for any leg gets no marks.
let (lx, ly) = legs(r, length);
if rectangle || lx > FLAT || ly > FLAT {
marked.push((anchor(d, id), r));
let at = anchor(d, id, &mut held);
// Marks placed outside the isolated art could not be selected or edited there.
if isolation.is_some_and(|iso| iso == at || !d.ancestry(at).is_some_and(|a| a.contains(&iso))) {
return Err(bad(C, "the marks would go outside the isolated art: exit isolation mode first"));
}
marked.push((at, r));
} else {
too_small = true;
}
@@ -288,6 +288,228 @@ fn marks_go_outside_a_clipping_sublayer_but_stay_in_a_clipping_top_layer() {
assert_eq!(stack.iter().position(|id| *id == mark), stack.iter().position(|id| *id == art).map(|i| i + 1), "{stack:?}");
}
#[test]
fn marks_on_envelope_sources_follow_the_drawn_bounds_once_per_live_object() {
for nested in [false, true] {
let mut s = session();
let a = rect(&mut s, 0.0, 0.0, 20.0, 20.0);
let b = rect(&mut s, 20.0, 0.0, 20.0, 20.0);
let top = rect(&mut s, 180.0, 120.0, 100.0, 60.0);
select(&mut s, &[a, b, top]);
let r = s.execute("object.envelope.makeWithTopObject", &json!({})).unwrap();
let envelope = NodeId(r["id"].as_u64().unwrap());
let outermost = if nested {
let r = s.execute("object.repeat.grid", &json!({"ids": [envelope.0], "rows": 2, "cols": 2})).unwrap();
NodeId(r["id"].as_u64().unwrap())
} else {
envelope
};
let layer = parent(&s, outermost);
let before = node(&s, outermost);
let d = &s.doc().unwrap().doc;
let drawn = vectorcraft_render::drawn_bounds(d, d.node(outermost).unwrap()).unwrap();
assert!(drawn.x0 > marks_bounds(&s, b).x1, "the visible art is away from its sources");
for selected in [vec![a], vec![a, b], vec![a, envelope]] {
for style in ["corners", "rectangle"] {
for bounds in ["geometric", "visual"] {
select(&mut s, &selected);
let n = steps(&s);
let r = s.execute(COMMAND, &json!({"style": style, "bounds": bounds})).unwrap();
let marks = ids_of(&r);
assert_eq!(r["count"], 1, "one set of marks for the live object");
assert_eq!(marks.len(), 1);
assert_eq!(children(&s, layer), vec![outermost, marks[0]]);
assert_eq!(node(&s, outermost), before);
assert!(near(marks_bounds(&s, marks[0]), (drawn.x0, drawn.y0, drawn.x1, drawn.y1)), "{nested}, {style}, {bounds}");
assert_eq!(steps(&s), n + 1);
assert_eq!(s.doc().unwrap().selection.objects.to_vec(), marks);
s.execute("edit.undo", &json!({})).unwrap();
assert_eq!(children(&s, layer), vec![outermost]);
assert_eq!(node(&s, outermost), before);
}
}
}
}
}
#[test]
fn marks_on_a_blend_key_or_compound_shape_operand_go_above_the_live_object() {
let mut s = session();
let a = rect(&mut s, 0.0, 0.0, 20.0, 20.0);
let b = rect(&mut s, 60.0, 0.0, 20.0, 20.0);
select(&mut s, &[a, b]);
s.execute("object.blend.make", &json!({})).unwrap();
let blend = s.doc().unwrap().selection.objects[0];
let layer = parent(&s, blend);
select(&mut s, &[a]);
let r = s.execute(COMMAND, &json!({})).unwrap();
let mark = ids_of(&r)[0];
assert_eq!(children(&s, blend), vec![a, b], "the blend keeps its keys");
assert_eq!(children(&s, layer), vec![blend, mark]);
assert!(near(marks_bounds(&s, mark), (0.0, 0.0, 20.0, 20.0)), "the key's own bounds");
s.execute("edit.undo", &json!({})).unwrap();
for stored_spine in [false, true] {
s.execute("object.blend.options", &json!({"id": blend.0, "orientation": if stored_spine { "page" } else { "path" }})).unwrap();
if stored_spine {
s.execute("object.blend.spine.reshapeSegment", &json!({"id": blend.0, "segment": 0, "t": 0.5, "dx": 0, "dy": 60})).unwrap();
}
let before = node(&s, blend);
let vectorcraft_doc::NodeKind::Blend { children: keys, spec } = &before.kind else { panic!("a blend") };
let drawn = vectorcraft_doc::live::blend_expand(keys, spec).iter().filter_map(Node::visual_bounds).reduce(|a, b| a.union(b)).unwrap();
select(&mut s, &[a, b]);
let r = s.execute(COMMAND, &json!({"bounds": "visual"})).unwrap();
let marks = ids_of(&r);
assert_eq!(r["count"], 1, "repositioned keys are measured as one live object");
assert_eq!(marks.len(), 1);
assert_eq!(children(&s, layer), vec![blend, marks[0]]);
assert_eq!(node(&s, blend), before);
assert!(near(marks_bounds(&s, marks[0]), (drawn.x0, drawn.y0, drawn.x1, drawn.y1)));
s.execute("edit.undo", &json!({})).unwrap();
}
let c = rect(&mut s, 100.0, 100.0, 30.0, 30.0);
let d = rect(&mut s, 110.0, 100.0, 30.0, 30.0);
select(&mut s, &[c, d]);
s.execute("object.compoundShape.make", &json!({"mode": "subtract"})).unwrap();
let shape = s.doc().unwrap().selection.objects[0];
select(&mut s, &[d]);
let r = s.execute(COMMAND, &json!({"style": "rectangle"})).unwrap();
let mark = ids_of(&r)[0];
assert_eq!(children(&s, shape), vec![c, d], "the compound shape keeps its operands");
assert!(near(marks_bounds(&s, mark), (110.0, 100.0, 140.0, 130.0)), "the operand's own bounds");
let stack = children(&s, parent(&s, shape));
assert_eq!(stack.iter().position(|id| *id == mark), stack.iter().position(|id| *id == shape).map(|i| i + 1), "{stack:?}");
s.execute("edit.undo", &json!({})).unwrap();
// With the compound shape isolated, the marks could only go outside the isolated art: refused.
s.execute("object.isolate", &json!({"id": shape.0})).unwrap();
select(&mut s, &[d]);
let (before, n) = (s.doc().unwrap().doc.clone(), steps(&s));
let refused = s.execute(COMMAND, &json!({})).unwrap_err().to_string();
assert!(refused.contains("outside the isolated art"), "{refused}");
assert_eq!(steps(&s), n, "no undo step");
assert!(*s.doc().unwrap().doc == *before);
}
#[test]
fn marks_on_an_outlined_glyph_stay_directly_above_it_inside_the_outlines_group() {
for isolated in [false, true] {
let mut s = session();
let text =
s.execute("text.create", &json!({"x": 20, "y": 60, "text": "AB", "size": 24, "font": "Source Sans 3", "style": "Regular"})).unwrap();
select(&mut s, &[NodeId(text["id"].as_u64().unwrap())]);
let outlines = ids_of(&s.execute("type.createOutlines", &json!({})).unwrap())[0];
let glyphs = children(&s, outlines);
if isolated {
s.execute("object.isolate", &json!({"id": outlines.0})).unwrap();
}
select(&mut s, &[glyphs[0]]);
let bounds = marks_bounds(&s, glyphs[0]);
let mark = ids_of(&s.execute(COMMAND, &json!({})).unwrap())[0];
assert_eq!(parent(&s, mark), outlines);
let mut expected = glyphs;
expected.insert(1, mark);
assert_eq!(children(&s, outlines), expected);
assert!(near(marks_bounds(&s, mark), (bounds.x0, bounds.y0, bounds.x1, bounds.y1)));
}
}
#[test]
fn marks_measure_blend_keys_and_steps_placed_on_a_diagonal_spine() {
let mut s = session();
let a = rect(&mut s, 20.0, 30.0, 40.0, 10.0);
let b = rect(&mut s, 120.0, 130.0, 20.0, 40.0);
select(&mut s, &[a, b]);
s.execute("paint.setStroke", &json!({"color": "#000000"})).unwrap();
s.execute("stroke.set", &json!({"weight": 8})).unwrap();
s.execute("object.blend.make", &json!({"spacing": "steps", "steps": 3, "orientation": "path"})).unwrap();
let blend = s.doc().unwrap().selection.objects[0];
let before = node(&s, blend);
let vectorcraft_doc::NodeKind::Blend { children: keys, spec } = &before.kind else { panic!("a blend") };
let placed = vectorcraft_doc::live::blend_expand(keys, spec);
assert!(placed.len() > keys.len());
let geometry = placed.iter().map(|n| n.path_data().unwrap().bounds().unwrap()).reduce(|a, b| a.union(b)).unwrap();
let visual = placed.iter().map(|n| n.visual_bounds().unwrap()).reduce(|a, b| a.union(b)).unwrap();
let stored = before.geometric_bounds().unwrap();
assert!(geometry.y0 < stored.y0 || geometry.y1 > stored.y1);
assert!(visual.x0 < geometry.x0 && visual.y0 < geometry.y0 && visual.x1 > geometry.x1 && visual.y1 > geometry.y1);
for selected in [vec![a], vec![a, b], vec![blend]] {
for style in ["corners", "rectangle"] {
for (bounds, expected) in [("geometric", geometry), ("visual", visual)] {
select(&mut s, &selected);
let n = steps(&s);
let r = s.execute(COMMAND, &json!({"style": style, "bounds": bounds})).unwrap();
let marks = ids_of(&r);
assert_eq!(r["count"], 1);
assert_eq!(marks.len(), 1);
let actual = marks_bounds(&s, marks[0]);
assert!(
near(actual, (expected.x0, expected.y0, expected.x1, expected.y1)),
"{selected:?}, {style}, {bounds}: {actual:?}, {expected:?}"
);
for shape in &placed {
let r = if bounds == "visual" { shape.visual_bounds().unwrap() } else { shape.path_data().unwrap().bounds().unwrap() };
assert!(actual.x0 <= r.x0 + 1e-6 && actual.y0 <= r.y0 + 1e-6 && actual.x1 >= r.x1 - 1e-6 && actual.y1 >= r.y1 - 1e-6);
}
assert_eq!(node(&s, blend), before);
assert_eq!(steps(&s), n + 1);
s.execute("edit.undo", &json!({})).unwrap();
assert_eq!(node(&s, blend), before);
}
}
}
}
#[test]
fn marks_on_a_dimension_part_go_above_the_live_object() {
let mut s = session();
let r = s.execute("dimension.create", &json!({"a": [0, 0], "b": [100, 0]})).unwrap();
let dimension = NodeId(r["id"].as_u64().unwrap());
let layer = parent(&s, dimension);
let parts = children(&s, dimension);
let before = node(&s, dimension);
select(&mut s, &[parts[0]]);
let r = s.execute(COMMAND, &json!({})).unwrap();
let mark = ids_of(&r)[0];
assert_eq!(children(&s, dimension), parts, "the dimension keeps its generated parts");
assert_eq!(node(&s, dimension), before);
assert_eq!(children(&s, layer), vec![dimension, mark]);
let before = node(&s, mark);
s.execute("dimension.update", &json!({"ids": [dimension.0], "offset": 40})).unwrap();
assert_eq!(children(&s, layer), vec![dimension, mark]);
assert_eq!(node(&s, mark), before, "updating the dimension preserves the mark");
}
#[test]
fn marks_on_an_image_trace_part_go_above_the_live_object() {
let mut s = session();
let art = rect(&mut s, 20.0, 30.0, 60.0, 40.0);
select(&mut s, &[art]);
s.execute("paint.setFill", &json!({"color": "#000000"})).unwrap();
s.execute("object.rasterize", &json!({"ppi": 72})).unwrap();
let r = s.execute("imageTrace.make", &json!({"params": {"ignoreWhite": true}})).unwrap();
let trace = NodeId(r["id"].as_u64().unwrap());
let layer = parent(&s, trace);
let parts = children(&s, trace);
let before = node(&s, trace);
let part = before.children().unwrap().iter().find(|n| n.path_data().is_some()).unwrap().id;
select(&mut s, &[part]);
let r = s.execute(COMMAND, &json!({})).unwrap();
let mark = ids_of(&r)[0];
assert_eq!(children(&s, trace), parts, "the trace keeps its generated parts");
assert_eq!(node(&s, trace), before);
assert_eq!(children(&s, layer), vec![trace, mark]);
let before = node(&s, mark);
let r = s.execute("imageTrace.make", &json!({"id": trace.0, "params": {"ignoreWhite": true, "threshold": 100}})).unwrap();
let retraced = NodeId(r["id"].as_u64().unwrap());
assert_eq!(children(&s, layer), vec![retraced, mark]);
assert_eq!(node(&s, mark), before, "retracing preserves the mark");
}
#[test]
fn flat_objects_get_lines_and_guides_and_empty_groups_none() {
let mut s = session();
+1 -1
View File
@@ -18487,7 +18487,7 @@ with strokes and vector effects included and raster effects left out (see its ro
| `addon.arrange.groupRows` | `direction`: `row` (vertical extents), `column` (horizontal extents) (`row` when omitted; `null` is invalid). Parameters must be an object. | Groups the selected objects (at most 20000) into one group for each row (column): an object joins a row when its visual bounds overlap the row's extent from top to bottom (left to right). Measurement includes strokes and vector effects, measures a clipping group by its mask, and excludes raster effects such as shadows, glows, and blurs. Extents that only touch stay apart, and an object that overlaps two rows joins them into one. Only objects in the same layer or group and on the same artboard (the one holding the object's center, else the one it overlaps most) share a row. Objects outside all artboards, locked or hidden objects, clipping masks, layers, and sublayers stay in place. Every grouping candidate must have a parent that is a layer or group. The command rejects selections containing editable live blend keys, direct children of Shaper groups, live compound shapes, Objects on Path groups, or Live Paint groups, and any descendants of live graphs. Complete live groups and graphs can be grouped with other artwork. An object alone in its row stays as it is. Each new group goes where its frontmost member was in the stacking order, and the groups (top to bottom, or left to right) and the objects left alone stay selected; with no row of two objects or more it makes no step. Needs two objects or more. → `{groups: [id…], grouped}` (how many objects went into groups) |
| `addon.arrange.randomizeOpacity` | `min`, `max` % 0…100 (30, 100; `min` not more than `max`); `seed` whole number (0); `ids` (the selection) | Gives each selected object its own opacity (the object opacity the Transparency panel sets), picked at random and evenly from `min` to `max`; the same seed, objects and range give the same opacities. Groups take one opacity of their own; the objects inside keep theirs. A run that changes no opacity, such as `min` and `max` both at the opacity every object has, records no undo step. → `{count}` |
| `addon.arrange.sort` | `by`, `apply`: `width`, `height`, `area` (width × height), `x` (left edge), `y` (top edge), `opacity` (%), `stacking` (stacking order from the back) (`area`, `stacking`); `order`: `ascending` (small to large), `descending` (large to small), `random` (`ascending`); `distribute` (false); `seed` whole number (0, for `random`); `scaleStrokes`; `ids` (the selection) | Sorts the selected objects (at most 20000) by `by` and gives them the values of `apply` in that order: the first gets the smallest value. Without `distribute` the objects trade the values they have; with it the values step evenly from the smallest to the largest. A width, height or area changes about each object's centre (an area in proportion), a place moves the top-left corner. Stacking order always trades places, and only among objects in the same layer or group. Needs two objects or more. → `{count}` |
| `addon.arrange.markBounds` | `style`: `corners`, `rectangle` (`corners`); `bounds`: `geometric` (strokes not counted), `visual` (strokes, brush art and effects as drawn) (`geometric`); `length` pt 0.001…1000000 (10, for `corners`); `weight` pt 0.01…1000 (1); `color` (`#ff0000`; an RGB color takes the document's color mode) | Draws marks on the bounds of each selected object (at most 20000), not around the whole selection: a group named Corner Marks of four L-shaped marks, one on each corner with its two legs running inward along the edges (each leg at most half the side it runs along), or a rectangle named Bounds. The marks have no fill and the stroke given, and go directly above their object, or above the outermost clip group or clipping sublayer that holds it. A clip group is measured by its clipping path and other groups by their members together. Guides and objects without bounds, such as empty groups, get no marks, and with `corners` neither does an object whose sides are too short for any leg; a selection with nothing to mark is an error that makes no step. The marks are selected. → `{ids, count}` |
| `addon.arrange.markBounds` | `style`: `corners`, `rectangle` (`corners`); `bounds`: `geometric` (strokes not counted), `visual` (strokes, brush art and effects as drawn) (`geometric`); `length` pt 0.001…1000000 (10, for `corners`); `weight` pt 0.01…1000 (1); `color` (`#ff0000`; an RGB color takes the document's color mode) | Draws marks on the bounds of each selected object (at most 20000), not around the whole selection: a group named Corner Marks of four L-shaped marks, one on each corner with its two legs running inward along the edges (each leg at most half the side it runs along), or a rectangle named Bounds. The marks have no fill and the stroke given, and go directly above their object, or above the outermost clip group, clipping sublayer or live object (a blend, compound path, compound shape, Shaper group, Objects on Path group, Live Paint group, dimension, graph, flare, envelope, mesh, repeat, intertwine, Image Trace group, generated art group, graph series, graph design copy or clipping pieces group) that holds it, so a blend key or compound shape operand gets its marks outside the live object. In isolation mode, an object whose marks would go outside the isolated art is an error that makes no step. Selected parts of compound paths, envelopes, meshes, repeats, Shaper groups and blends with a stored spine or Align to Path, and hidden Image Trace sources, are measured as the outermost such live object, with one set of marks per object. Other blend keys and compound shape operands keep their own bounds. A clip group is measured by its clipping path and other groups by their members together. Guides and objects without bounds, such as empty groups, get no marks, and with `corners` neither does an object whose sides are too short for any leg; a selection with nothing to mark is an error that makes no step. The marks are selected. → `{ids, count}` |
Zoom to Selection is the UI command `addon.arrange.zoomSelection {}` (remote mode only): it zooms and centres the
active view so the selection's visual bounds fill the window with a margin, as `view.fitArtboard` fits the artboard,
+1 -1
View File
@@ -3191,7 +3191,7 @@ A VectorCraft addition, so no area score moves. Object › Plug-ins › Arrange
## Arrange Tools add-on: Mark Bounds of Each (2026-11-29)
A VectorCraft addition, so no area score moves. Object › Plug-ins › Arrange Tools › Mark Bounds of Each… draws marks on each top-level selected object's bounds (at most 20000 objects), rather than around the whole selection. Draw is Corner Marks by default (four inward L-shaped marks in a group named Corner Marks), or Rectangle (one closed path named Bounds). Bounds is Geometric Bounds by default (strokes not counted), or Visual Bounds (strokes, brush art and effects as drawn). Length is 0.001 to 1000000 pt (10 by default), with each corner leg capped at half the side it runs along; Length is off in the dialog for Rectangle. Weight is 0.01 to 1000 pt (1 by default), and Color defaults to red (`#ff0000`); an RGB color takes the document's color mode. The marks have no fill and the stroke given. Each goes directly above its object, or above the outermost clip group or clipping sublayer that holds it; a clipping top-level layer keeps the marks inside it. Clip groups are measured by their clipping path, other groups by their members together. For flat objects, corner marks become lines along their nonzero side; an object whose sides are too short for any leg gets no corner marks. Guides and objects without bounds, such as empty groups, are skipped; nothing to mark is an error with no undo step. The new marks become selected, in one undo step. The dialog has Preview; OK keeps the marks and Cancel removes the preview. Tests: `each_object_gets_inward_corner_marks_above_it_in_one_step`, `length_weight_color_and_the_rectangle_style`, `a_leg_is_at_most_half_the_side_it_runs_along_vertically`, `geometric_bounds_leave_strokes_out_and_visual_bounds_count_them`, `visual_bounds_enclose_a_drop_shadow_and_geometric_bounds_leave_it_out`, `visual_bounds_enclose_brush_art_on_paths_and_in_groups`, `groups_by_their_members_and_clip_groups_by_the_clipping_path`, `marks_go_outside_a_clipping_sublayer_but_stay_in_a_clipping_top_layer`, `flat_objects_get_lines_and_guides_and_empty_groups_none`, `an_object_too_small_for_corner_legs_gets_no_empty_group` and `bad_params_are_refused_and_it_is_off_without_a_selection` in `cmd::addons::arrange::marks::tests` in `vectorcraft-engine`; `real_mark_bounds_edits_reach_the_preview_ok_keeps_them_and_cancel_drops_them` and `mark_bounds_sends_the_dialog_values_to_its_command` in `crates/ui-egui/src/addons/arrange/tests.rs` in `vectorcraft-ui-egui`; and `command_sweep`. Commands: `docs/mcp.md` › Arrange Tools add-on.
A VectorCraft addition, so no area score moves. Object › Plug-ins › Arrange Tools › Mark Bounds of Each… draws marks on each top-level selected object's bounds (at most 20000 objects), rather than around the whole selection. Draw is Corner Marks by default (four inward L-shaped marks in a group named Corner Marks), or Rectangle (one closed path named Bounds). Bounds is Geometric Bounds by default (strokes not counted), or Visual Bounds (strokes, brush art and effects as drawn). Length is 0.001 to 1000000 pt (10 by default), with each corner leg capped at half the side it runs along; Length is off in the dialog for Rectangle. Weight is 0.01 to 1000 pt (1 by default), and Color defaults to red (`#ff0000`); an RGB color takes the document's color mode. The marks have no fill and the stroke given. Each goes directly above its object, or above the outermost clip group, clipping sublayer or live object (a blend, compound path, compound shape, Shaper group, Objects on Path group, Live Paint group, dimension, graph, flare, envelope, mesh, repeat, intertwine, Image Trace group, generated art group, graph series, graph design copy or clipping pieces group) that holds it; a clipping top-level layer keeps the marks inside it. In isolation mode, marks that would go outside the isolated art are an error with no undo step. Selected parts of compound paths, envelopes, meshes, repeats, Shaper groups and blends with a stored spine or Align to Path, and hidden Image Trace sources, are measured as the outermost such live object, with one set of marks per object. Other blend keys and compound shape operands keep their own bounds. Clip groups are measured by their clipping path, other groups by their members together. For flat objects, corner marks become lines along their nonzero side; an object whose sides are too short for any leg gets no corner marks. Guides and objects without bounds, such as empty groups, are skipped; nothing to mark is an error with no undo step. The new marks become selected, in one undo step. The dialog has Preview; OK keeps the marks and Cancel removes the preview. Tests: `each_object_gets_inward_corner_marks_above_it_in_one_step`, `length_weight_color_and_the_rectangle_style`, `a_leg_is_at_most_half_the_side_it_runs_along_vertically`, `geometric_bounds_leave_strokes_out_and_visual_bounds_count_them`, `visual_bounds_enclose_a_drop_shadow_and_geometric_bounds_leave_it_out`, `visual_bounds_enclose_brush_art_on_paths_and_in_groups`, `groups_by_their_members_and_clip_groups_by_the_clipping_path`, `marks_go_outside_a_clipping_sublayer_but_stay_in_a_clipping_top_layer`, `marks_on_envelope_sources_follow_the_drawn_bounds_once_per_live_object`, `marks_on_a_blend_key_or_compound_shape_operand_go_above_the_live_object`, `marks_on_a_dimension_part_go_above_the_live_object`, `marks_on_an_image_trace_part_go_above_the_live_object`, `marks_on_an_outlined_glyph_stay_directly_above_it_inside_the_outlines_group`, `flat_objects_get_lines_and_guides_and_empty_groups_none`, `an_object_too_small_for_corner_legs_gets_no_empty_group` and `bad_params_are_refused_and_it_is_off_without_a_selection` in `cmd::addons::arrange::marks::tests` in `vectorcraft-engine`; `real_mark_bounds_edits_reach_the_preview_ok_keeps_them_and_cancel_drops_them` and `mark_bounds_sends_the_dialog_values_to_its_command` in `crates/ui-egui/src/addons/arrange/tests.rs` in `vectorcraft-ui-egui`; and `command_sweep`. Commands: `docs/mcp.md` › Arrange Tools add-on.
## Arrange Tools add-on: Group by Row (2026-11-29)
+1 -1
View File
@@ -585,7 +585,7 @@ next unit in the order a right-click on a ruler lists them, from Feet back to Po
| Arrange Tools add-on (VectorCraft addition): Object › Plug-ins › Arrange Tools › Randomize Opacity… gives each selected object its own opacity at random between Minimum and Maximum (%), with a Seed that repeats it and Preview, one undo step | done | #4925; `addon.arrange.randomizeOpacity`, `crates/engine/src/cmd/addons/arrange.rs`, `crates/ui-egui/src/addons/arrange.rs` and their tests; not a feature of the reference app, so it is not scored | unknown |
| Arrange Tools add-on (VectorCraft addition): Object › Plug-ins › Arrange Tools › Sort Objects… sorts the selected objects by Sort By (width, height, area, X or Y position, opacity, stacking order) in an Order (Small to Large, Large to Small, Random) and gives them Apply To in that order, trading the values or with Distribute Evenly; Scale Strokes & Effects; Preview; one undo step | done | #4917; `addon.arrange.sort`, `crates/engine/src/cmd/addons/arrange.rs`, `crates/ui-egui/src/addons/arrange.rs` and their tests; not a feature of the reference app, so it is not scored | unknown |
| Arrange Tools add-on (VectorCraft addition): Object › Plug-ins › Arrange Tools › Offset Objects… chains the selected objects one after another in a Direction (Row (Left to Right) or Column (Top to Bottom)) with a Gap (negative overlaps), in an Order (Stacking Order or Position) with Reverse Order; the first stays in place and the others move only along the row or column; Preview; one undo step | done | `addon.arrange.offset`, `crates/engine/src/cmd/addons/arrange.rs`, `crates/ui-egui/src/addons/arrange.rs` and their tests; a VectorCraft addition, so it is not scored | unknown |
| Arrange Tools add-on (VectorCraft addition): Object › Plug-ins › Arrange Tools › Mark Bounds of Each… draws inward Corner Marks or a Rectangle on each selected object's Geometric Bounds or Visual Bounds, with Length, Weight, Color and Preview; marks go above the object or its outermost clip group or clipping sublayer and become selected; one undo step | done | `addon.arrange.markBounds`, `crates/engine/src/cmd/addons/arrange/marks.rs`, `crates/ui-egui/src/addons/arrange.rs` and their tests; a VectorCraft addition, so it is not scored | unknown |
| Arrange Tools add-on (VectorCraft addition): Object › Plug-ins › Arrange Tools › Mark Bounds of Each… draws inward Corner Marks or a Rectangle on each selected object's Geometric Bounds or Visual Bounds, with Length, Weight, Color and Preview. Marks go above the object or its outermost clip group, clipping sublayer or live object and become selected in one undo step. Marks that would go outside isolated art cause an error without an undo step. Selected parts of compound paths, envelopes, meshes, repeats, Shaper groups and blends with a stored spine or Align to Path, and hidden Image Trace sources, are measured as the outermost such live object, with one set of marks per object. Other blend keys and compound shape operands keep their own bounds. | done | `addon.arrange.markBounds`, `crates/engine/src/cmd/addons/arrange/marks.rs`, `crates/ui-egui/src/addons/arrange.rs` and their tests; a VectorCraft addition, so it is not scored | unknown |
| Arrange Tools add-on (VectorCraft addition): Object › Plug-ins › Arrange Tools › Group by Row… groups the selected objects whose visual bounds overlap from top to bottom into one group for each row, or with Group By Columns from left to right (within one layer or group and one artboard), each group at its frontmost member's stacking place; Preview; one undo step | done | `addon.arrange.groupRows`, `crates/engine/src/cmd/addons/arrange.rs`, `crates/ui-egui/src/addons/arrange.rs` and their tests; a VectorCraft addition, so it is not scored | unknown |
| Document Tools add-on (VectorCraft addition): Object › Plug-ins › Document Tools › Save a Timestamped Copy writes `<name>_YYYY-MM-DD_HH-MM.<ext>` next to the document (a folder picked for one never saved), which keeps its path, title and modified state; off on the web | done | #4926; `addon.document.saveTimestampedCopy`, `crates/engine/src/cmd/addons/document.rs`, `crates/ui-egui/src/addons/document.rs` and their tests; not a feature of the reference app, so it is not scored | unknown |
| Document Tools add-on (VectorCraft addition): Export All Open Documents as PDF / as SVG (#4920) | done | asks for a folder, writes a copy of every open document named after it (taken names numbered, nothing replaced), documents and active tab unchanged; failures named in the status bar | unknown |