Merge pull request #10139 from dotCooCoo/feat/group-rows

Arrange Tools: Group by Row puts each row of the selection in its own group
This commit is contained in:
.CooCoo authored and GitHub committed 2026-12-01 06:26:18 -08:00
commit 38e453c034
12 files changed
+704 -11

No files matched your search

+1
View File
@@ -166,6 +166,7 @@ Ranked; detail in [docs/roadmap.md](docs/roadmap.md) and [docs/gaps.md](docs/gap
- 2026-11-29: Mark Bounds of Each joins the Arrange Tools add-on (Object › Plug-ins › Arrange Tools): each selected object gets its own inward corner marks, or a rectangle, on its geometric or visual bounds, stroked in the color and weight given, stacked directly above it; clip groups are measured by their clipping path. A dialog with Preview, one undo step (`addon.arrange.markBounds`). A VectorCraft addition: headline numbers unchanged.
- 2026-11-29: Match Objects joins the Arrange Tools add-on (Object › Plug-ins › Arrange Tools): the other selected objects take the width, the height or both, the bounding-box angle and the stacking place of the key object, or of the top or the bottom selected object, about a reference point, with Preview, as one undo step (`addon.arrange.match`). A VectorCraft addition: headline numbers unchanged.
- 2026-11-29: Offset Objects joins the Arrange Tools add-on (Object › Plug-ins › Arrange Tools): the selected objects are chained one after another in a row or a column with a set gap (negative to overlap them), in stacking order or by position, either way; the first stays in place and the others move only along the row or column, as one undo step (`addon.arrange.offset`). A VectorCraft addition: headline numbers unchanged.
- 2026-11-29: Group by Row joins the Arrange Tools add-on (Object › Plug-ins › Arrange Tools): the selected objects whose visual bounds overlap from top to bottom go into one group for each row (or, by column, from left to right), within their own layer or group and artboard, at the stacking place of their frontmost member; an object alone in its row stays as it is. One undo step, with a previewed dialog (`addon.arrange.groupRows`). A VectorCraft addition: headline numbers unchanged.
- 2026-11-15: Tangent Circle joins the Path Precision Tools add-on (Object › Plug-ins › Path Precision Tools): the circles that touch two selected paths or compound paths at a set radius, or three of them (up to eight for three circles), touching each outline without crossing it; circles, rotated ellipses and other paths alike. A dialog that previews every circle or one picked by number, the current paint, one undo step (`addon.pathtools.tangentCircle`). A VectorCraft addition: headline numbers unchanged.
- 2026-11-17: Add Bounding Rectangle and Add Bounding Circle join the Path Precision Tools add-on (Object › Plug-ins › Path Precision Tools): a live rectangle on the selection's geometric bounding box, or the smallest live circle that holds its outlines, around the whole selection or around each object, with the current paint and one undo step; the menu items open a dialog with Offset, One per Object and Preview (`addon.pathtools.boundingRectangle`, `addon.pathtools.boundingCircle`, #6966). A VectorCraft addition: headline numbers unchanged.
- 2026-11-22: Add Inscribed Circle joins the Path Precision Tools add-on (Object › Plug-ins › Path Precision Tools): the largest live circle inside each selected closed path or compound path, in the area it fills under its fill rule, with the current paint and one undo step (`addon.pathtools.inscribedCircle`, #6966). A VectorCraft addition: headline numbers unchanged.
+112 -3
View File
@@ -5,7 +5,8 @@
//! others; and Set Size of Each gives every selected object an exact width and height. Places and
//! sizes are measured and set as `object.setBounds` does. Match Objects gives the other selected
//! objects the size, bounding-box angle and stacking place of one of them. Group Overlapping Objects groups the
//! objects whose visual bounds overlap, Randomize Opacity gives each selected object a random
//! objects whose visual bounds overlap, Group by Row groups them by the rows (or columns) their
//! visual bounds share, Randomize Opacity gives each selected object a random
//! opacity, and Sort Objects sorts the selected objects by one attribute and gives them another in
//! that order. Mark Bounds of Each ([`marks`]) draws marks on the bounds of each selected object.
//! Its submenu (Object › Plug-ins › Arrange Tools), its dialogs and Zoom to Selection (a view
@@ -20,7 +21,7 @@ use std::sync::Arc;
use serde_json::{Value, json};
use vectorcraft_color::recolor::Rng;
use vectorcraft_doc::{Node, NodeId, OrientedBox};
use vectorcraft_doc::{Node, NodeId, NodeKind, OrientedBox};
use vectorcraft_geom::{Affine, Point, Rect, Vec2};
use vectorcraft_render::effects;
@@ -110,6 +111,15 @@ pub fn specs() -> Vec<CommandSpec> {
has_multi,
group_overlapping
),
cmd!(
"addon.arrange.groupRows",
"Group by Row",
["Object", "Plug-ins", "Arrange Tools"],
None,
"{direction?: \"row\" (objects whose vertical extents overlap) | \"column\" (objects whose horizontal extents overlap) (\"row\" when omitted; null is invalid)} group the selected objects (the top-level ones, at most 20000) into one group for each row (column), as one undo step. Parameters must be an object. An object joins a row when its visual bounds overlap the row's extent across it. 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, and each new group goes where its frontmost member was in the stacking order; the new groups (top to bottom, or left to right) and the objects left alone stay selected. A run with no row of two or more objects makes no step → {groups: [id…], grouped (how many objects went into groups)}",
has_multi,
group_rows
),
cmd!(
"addon.arrange.randomizeOpacity",
"Randomize Opacity",
@@ -582,11 +592,110 @@ fn group_overlapping(s: &mut Session, _: &Value) -> Result<Value> {
roots.iter().filter_map(|id| Some((*id, (d.parent_of(*id), effects::preview::bounds_of(d, &[*id], true)?)))).collect();
let keyed: Vec<(Option<NodeId>, Rect)> = items.iter().map(|(_, k)| *k).collect();
let sets: Vec<Vec<NodeId>> = overlapping(&keyed).into_iter().map(|set| set.iter().filter_map(|i| Some(items.get(*i)?.0)).collect()).collect();
group_each(s, "Group Overlapping Objects", &roots, sets)
}
/// The rows of `items` (each a key and an extent `(start, end)` along the axis across the rows): the sets of
/// two or more (each in the order given) among items of the same key whose extents overlap, chains included.
/// Extents that only touch stay apart. Sorted by start, then by end, each item joins its key's open row when it
/// starts before that row ends, so the rows come out in order along the axis, and an extent with no length at
/// another's start stays apart from it whatever their order. Adding 0.0 turns -0.0 into 0.0, which
/// `total_cmp` would otherwise order first.
fn rows_of<K: Eq + std::hash::Hash + Copy>(items: &[(K, (f64, f64))]) -> Vec<Vec<usize>> {
let items: Vec<(K, (f64, f64))> = items.iter().map(|(k, (start, end))| (*k, (start + 0.0, end + 0.0))).collect();
let mut order: Vec<usize> = (0..items.len()).collect();
order.sort_by(|a, b| items[*a].1.0.total_cmp(&items[*b].1.0).then(items[*a].1.1.total_cmp(&items[*b].1.1)));
let mut rows: Vec<Vec<usize>> = vec![];
// Each key's open row: its index in `rows` and where it ends.
let mut open: HashMap<K, (usize, f64)> = HashMap::new();
for i in order {
let (key, (start, end)) = items[i];
match open.get_mut(&key) {
Some((row, until)) if start < *until => {
if let Some(r) = rows.get_mut(*row) {
r.push(i);
}
*until = until.max(end);
}
_ => {
open.insert(key, (rows.len(), end));
rows.push(vec![i]);
}
}
}
rows.retain(|r| r.len() > 1);
for r in &mut rows {
r.sort_unstable();
}
rows
}
fn group_rows(s: &mut Session, p: &Value) -> Result<Value> {
const C: &str = "addon.arrange.groupRows";
if !p.is_object() {
return Err(bad(C, "parameters must be an object"));
}
if p.get("direction").is_some_and(Value::is_null) {
return Err(bad(C, "`direction` must be row or column"));
}
let rows = choice(p, C, "direction", &["row", "column"])?.unwrap_or("row") == "row";
let roots = selected_roots(s)?;
if roots.len() > MAX_OBJECTS {
return Err(bad(C, "too many objects selected (at most 20000)"));
}
let d = &s.doc()?.doc;
let editable_roots: Vec<_> = {
let editable = d.editable();
roots.iter().copied().filter(|id| editable(*id) && d.node(*id).is_some_and(|n| !n.is_layer())).collect()
};
for id in &editable_roots {
let parent = d.parent_of(*id);
let valid_parent = parent.and_then(|parent| d.node(parent)).is_some_and(|n| {
matches!(n.kind, NodeKind::Layer { .. } | NodeKind::Group { .. })
&& !n.is_compound_shape()
&& n.extras().shaper.is_none()
&& n.extras().objects_on_path.is_none()
&& !vectorcraft_tools::builder::is_live_paint(n)
});
let in_graph = parent
.and_then(|parent| d.ancestry(parent))
.is_some_and(|ancestors| ancestors.iter().any(|ancestor| d.node(*ancestor).is_some_and(|n| n.extras().graph.is_some())));
if !valid_parent || in_graph {
return Err(bad(C, "selected objects must be in a layer or group without live structural roles"));
}
}
// Each object's row key (its parent and its artboard) and its extent across the rows.
type Keyed = ((NodeId, usize), (f64, f64));
let symbols = d.symbol_boxes();
let items: Vec<(NodeId, Keyed)> = editable_roots
.iter()
.filter_map(|id| {
let parent = d.parent_of(*id)?;
let container = d.node(parent)?;
if container.clips() && container.children().and_then(|c| c.first()).is_some_and(|c| c.id == *id) {
return None;
}
let b = effects::preview::visual_bounds(&symbols.unmeasured(), d.node(*id)?)?;
let extent = if rows { (b.y0, b.y1) } else { (b.x0, b.x1) };
Some((*id, ((parent, d.artboard_for_bounds(b)?), extent)))
})
.collect();
let keyed: Vec<_> = items.iter().map(|(_, k)| *k).collect();
let sets: Vec<Vec<NodeId>> = rows_of(&keyed).into_iter().map(|set| set.iter().filter_map(|i| Some(items.get(*i)?.0)).collect()).collect();
let mut selection = roots;
selection.extend(s.doc()?.selection.objects.iter().copied().filter(|id| d.node(*id).is_some_and(|n| n.is_layer())));
group_each(s, if rows { "Group by Row" } else { "Group by Column" }, &selection, sets)
}
/// Put each of `sets` (two or more of the selected top-level objects `roots`, each in stacking order) into a
/// new group of its own at its frontmost member's place, as undo step `label`, and select the new groups and
/// the objects of `roots` left alone. No step when `sets` is empty.
fn group_each(s: &mut Session, label: &str, roots: &[NodeId], sets: Vec<Vec<NodeId>>) -> Result<Value> {
if sets.is_empty() {
return Ok(json!({ "groups": [], "grouped": 0 }));
}
let grouped: std::collections::HashSet<NodeId> = sets.iter().flatten().copied().collect();
let groups = s.edit("Group Overlapping Objects", |d, sel| {
let groups = s.edit(label, |d, sel| {
// Every group at once: the members behind each front one go, then each front one is
// replaced by its group (one pass over the tree each, however many groups).
let (mut places, mut behind, mut groups) = (vec![], vec![], vec![]);
@@ -779,6 +779,7 @@ fn off_without_a_selection() {
"addon.arrange.size",
"addon.arrange.match",
"addon.arrange.groupOverlapping",
"addon.arrange.groupRows",
"addon.arrange.randomizeOpacity",
"addon.arrange.sort",
] {
@@ -862,6 +863,503 @@ fn group_overlapping_is_off_with_one_object_and_scales_to_many() {
assert!(sets.iter().all(|s| s.len() == 2 && s[1] == s[0] + 1));
}
fn layer_children(s: &Session) -> Vec<NodeId> {
s.doc().unwrap().doc.layers[0].children().unwrap().iter().map(|n| n.id).collect()
}
#[test]
fn group_rows_groups_each_row_and_leaves_loners() {
let mut s = session();
// Row one: a and b (y 0 to 12). c only touches it (from y 12), alone in its row. Row two: d and e.
let a = rect(&mut s, 0.0, 0.0, 10.0, 10.0);
let d = rect(&mut s, 0.0, 40.0, 10.0, 10.0);
let b = rect(&mut s, 20.0, 2.0, 10.0, 10.0);
let c = rect(&mut s, 40.0, 12.0, 10.0, 10.0);
let e = rect(&mut s, 20.0, 45.0, 10.0, 10.0);
select(&mut s, &[a, b, c, d, e]);
let n = steps(&s);
let r = s.execute("addon.arrange.groupRows", &json!({})).unwrap();
assert_eq!(steps(&s), n + 1, "one undo step");
assert_eq!(r["grouped"], json!(4));
let groups = ids_of(&r["groups"]);
assert_eq!(groups.len(), 2);
assert_eq!(children(&s, groups[0]), [a, b], "the top row first, its members in stacking order");
assert_eq!(children(&s, groups[1]), [d, e]);
// Each group where its frontmost member was: a d b c e → group(ab) at b, c, group(de) at e.
assert_eq!(layer_children(&s), [groups[0], c, groups[1]]);
let sel = &s.doc().unwrap().selection.objects;
assert!(sel.contains(&groups[0]) && sel.contains(&groups[1]) && sel.contains(&c) && sel.len() == 3, "{sel:?}");
assert_eq!(s.doc().unwrap().history.undo.last().map(|step| step.label.as_str()), Some("Group by Row"));
s.execute("edit.undo", &json!({})).unwrap();
assert_eq!(layer_children(&s), [a, d, b, c, e]);
}
#[test]
fn group_rows_makes_columns_and_joins_rows_an_object_spans() {
let mut s = session();
// Columns: a and b share x 0 to 15, c stands apart.
let a = rect(&mut s, 0.0, 0.0, 10.0, 10.0);
let b = rect(&mut s, 5.0, 50.0, 10.0, 10.0);
let c = rect(&mut s, 30.0, 0.0, 10.0, 10.0);
select(&mut s, &[a, b, c]);
let r = s.execute("addon.arrange.groupRows", &json!({"direction": "column"})).unwrap();
let groups = ids_of(&r["groups"]);
assert_eq!(groups.len(), 1);
assert_eq!(children(&s, groups[0]), [a, b]);
assert_eq!(s.doc().unwrap().history.undo.last().map(|step| step.label.as_str()), Some("Group by Column"));
// By row, p and q lie in two rows until r, reaching from one to the other, joins them.
let mut s = session();
let p = rect(&mut s, 0.0, 0.0, 10.0, 10.0);
let q = rect(&mut s, 50.0, 20.0, 10.0, 10.0);
select(&mut s, &[p, q]);
let n = steps(&s);
let r = s.execute("addon.arrange.groupRows", &json!({"direction": "row"})).unwrap();
assert_eq!((r["grouped"].clone(), steps(&s)), (json!(0), n), "two rows of one: no groups, no step");
let bridge = rect(&mut s, 100.0, 5.0, 10.0, 20.0);
select(&mut s, &[p, q, bridge]);
let r = s.execute("addon.arrange.groupRows", &json!({"direction": "row"})).unwrap();
let groups = ids_of(&r["groups"]);
assert_eq!(groups.len(), 1);
assert_eq!(children(&s, groups[0]), [p, q, bridge]);
}
#[test]
fn group_rows_keeps_layers_and_artboards_apart_and_measures_visual_bounds() {
let mut s = session();
s.execute("artboard.new", &json!({"x": 500, "y": 0, "width": 200, "height": 300})).unwrap();
let a = rect(&mut s, 0.0, 0.0, 20.0, 20.0);
// Touching a's bottom edge: a row of its own until strokes reach over the edge.
let below = rect(&mut s, 50.0, 20.0, 20.0, 20.0);
let far = rect(&mut s, 550.0, 0.0, 20.0, 20.0);
s.execute("layer.new", &json!({})).unwrap();
let other = rect(&mut s, 100.0, 0.0, 20.0, 20.0);
select(&mut s, &[a, below, far, other]);
let n = steps(&s);
let r = s.execute("addon.arrange.groupRows", &json!({})).unwrap();
assert_eq!((r["grouped"].clone(), steps(&s)), (json!(0), n), "another artboard, another layer, a touching edge: no groups");
select(&mut s, &[a, below]);
s.execute("paint.setStroke", &json!({"color": "#000000"})).unwrap();
s.execute("stroke.set", &json!({"weight": 4})).unwrap();
select(&mut s, &[a, below, far, other]);
let r = s.execute("addon.arrange.groupRows", &json!({})).unwrap();
let groups = ids_of(&r["groups"]);
assert_eq!(groups.len(), 1);
assert_eq!(children(&s, groups[0]), [a, below], "the strokes overlap");
let doc = &s.doc().unwrap().doc;
assert_ne!(doc.parent_of(far), Some(groups[0]), "left on its own artboard");
assert_ne!(doc.layer_of(other), doc.layer_of(a), "left in its own layer");
}
#[test]
fn group_rows_measures_clipping_groups_by_their_mask() {
let mut s = session();
let a = rect(&mut s, 0.0, 0.0, 20.0, 20.0);
// A 200 tall object clipped to a 30 tall mask at y 100.
let clipped = rect(&mut s, 50.0, 0.0, 10.0, 200.0);
let mask = rect(&mut s, 40.0, 100.0, 30.0, 30.0);
select(&mut s, &[clipped, mask]);
s.execute("object.clippingMask.make", &json!({})).unwrap();
let group = s.doc().unwrap().selection.objects[0];
let b = rect(&mut s, 100.0, 110.0, 10.0, 10.0);
select(&mut s, &[a, group, b]);
let r = s.execute("addon.arrange.groupRows", &json!({})).unwrap();
let groups = ids_of(&r["groups"]);
assert_eq!(groups.len(), 1);
assert_eq!(children(&s, groups[0]), [group, b], "the mask's row, not the clipped art's");
}
#[test]
fn group_rows_keeps_clipping_masks_first_in_groups_and_layers() {
for clipping_layer in [false, true] {
let mut s = session();
let mask = rect(&mut s, 0.0, 0.0, 100.0, 100.0);
let a = rect(&mut s, 10.0, 10.0, 20.0, 20.0);
let b = rect(&mut s, 40.0, 10.0, 20.0, 20.0);
select(&mut s, &[mask, a, b]);
let parent = if clipping_layer {
s.doc().unwrap().doc.layers[0].id
} else {
s.execute("object.group", &json!({})).unwrap();
s.doc().unwrap().selection.objects[0]
};
s.edit("Set clipping", |d, _| {
d.node_mut(parent).unwrap().set_clips(true);
Ok(())
})
.unwrap();
select(&mut s, &[mask, a]);
let n = steps(&s);
let r = s.execute("addon.arrange.groupRows", &json!({})).unwrap();
assert_eq!((r["grouped"].clone(), steps(&s)), (json!(0), n));
assert_eq!(children(&s, parent), [mask, a, b]);
select(&mut s, &[mask, a, b]);
let before = s.doc().unwrap().doc.clone();
let r = s.execute("addon.arrange.groupRows", &json!({})).unwrap();
let groups = ids_of(&r["groups"]);
assert_eq!(r["grouped"], json!(2));
assert_eq!(children(&s, parent), [mask, groups[0]]);
assert_eq!(children(&s, groups[0]), [a, b]);
assert!(s.doc().unwrap().selection.objects.contains(&mask));
s.execute("edit.undo", &json!({})).unwrap();
assert!(*s.doc().unwrap().doc == *before);
}
}
#[test]
fn group_rows_leaves_selected_layers_and_sublayers_in_place() {
for sublayers in [false, true] {
let mut s = session();
let parent = s.doc().unwrap().doc.layers[0].id;
let mut layers = vec![];
for _ in 0..2 {
let command = if sublayers { "layer.newSublayer" } else { "layer.new" };
let params = if sublayers { json!({"parent": parent.0}) } else { json!({"top": true}) };
let layer = NodeId(s.execute(command, &params).unwrap()["id"].as_u64().unwrap());
rect(&mut s, 10.0, 10.0, 20.0, 20.0);
layers.push(layer);
}
s.execute("layer.setCurrent", &json!({"id": parent.0})).unwrap();
let a = rect(&mut s, 10.0, 10.0, 20.0, 20.0);
let b = rect(&mut s, 15.0, 15.0, 20.0, 20.0);
for direction in ["row", "column"] {
select(&mut s, &layers);
let before = s.doc().unwrap().doc.clone();
let n = steps(&s);
let r = s.execute("addon.arrange.groupRows", &json!({"direction": direction})).unwrap();
assert_eq!(r["grouped"], json!(0), "layers must not become ordinary group members");
assert_eq!(steps(&s), n);
assert!(*s.doc().unwrap().doc == *before);
select(&mut s, &[layers[0], layers[1], a, b]);
let r = s.execute("addon.arrange.groupRows", &json!({"direction": direction})).unwrap();
assert_eq!(r["grouped"], json!(2));
let groups = ids_of(&r["groups"]);
assert_eq!(children(&s, groups[0]), [a, b]);
for layer in &layers {
assert_eq!(s.doc().unwrap().doc.parent_of(*layer), sublayers.then_some(parent));
assert!(s.doc().unwrap().selection.objects.contains(layer));
}
s.execute("edit.undo", &json!({})).unwrap();
assert!(*s.doc().unwrap().doc == *before);
}
}
}
#[test]
fn group_rows_refuses_objects_without_a_parent() {
let mut s = session();
let a = rect(&mut s, 10.0, 10.0, 20.0, 20.0);
let b = rect(&mut s, 15.0, 15.0, 20.0, 20.0);
s.edit("Set root objects", |d, _| {
for id in [a, b] {
let node = d.remove(id)?;
d.layers.push(node);
}
Ok(())
})
.unwrap();
select(&mut s, &[a, b]);
refuses(&mut s, "addon.arrange.groupRows", &[json!({"direction": "row"}), json!({"direction": "column"})]);
}
fn refuse_row_parts_and_group_whole(s: &mut Session, group: NodeId, parts: &[Vec<NodeId>]) {
let center = bounds(s, group).center();
let a = rect(s, center.x - 10.0, center.y - 10.0, 20.0, 20.0);
let b = rect(s, center.x - 5.0, center.y - 5.0, 20.0, 20.0);
let members = children(s, group);
for direction in ["row", "column"] {
for selected in parts {
select(s, selected);
let selection = s.doc().unwrap().selection.clone();
refuses(s, "addon.arrange.groupRows", &[json!({"direction": direction})]);
assert_eq!(s.doc().unwrap().selection, selection);
let mut mixed = selected.clone();
mixed.extend([a, b]);
select(s, &mixed);
refuses(s, "addon.arrange.groupRows", &[json!({"direction": direction})]);
assert_eq!(children(s, group), members);
}
select(s, &[group, a, b]);
let before = s.doc().unwrap().doc.clone();
let n = steps(s);
let r = s.execute("addon.arrange.groupRows", &json!({"direction": direction})).unwrap();
assert_eq!(r["grouped"], json!(3));
let groups = ids_of(&r["groups"]);
assert_eq!(children(s, groups[0]), [group, a, b]);
assert_eq!(children(s, group), members);
assert_eq!(steps(s), n + 1);
s.execute("edit.undo", &json!({})).unwrap();
assert!(*s.doc().unwrap().doc == *before);
}
}
#[test]
fn group_rows_refuses_objects_on_path_children_but_groups_the_whole_group() {
let mut s = session();
let path = rect(&mut s, 20.0, 20.0, 100.0, 100.0);
let member = rect(&mut s, 30.0, 30.0, 20.0, 20.0);
let group = NodeId(s.execute("object.objectsOnPath.attach", &json!({"path": path.0, "ids": [member.0]})).unwrap()["id"].as_u64().unwrap());
refuse_row_parts_and_group_whole(&mut s, group, &[vec![path, member]]);
assert!(s.doc().unwrap().doc.node(group).unwrap().extras().objects_on_path.is_some());
}
#[test]
fn group_rows_refuses_live_paint_faces_and_edges_but_groups_the_whole_group() {
let mut s = session();
let a = rect(&mut s, 0.0, 0.0, 100.0, 100.0);
let b = rect(&mut s, 50.0, 0.0, 100.0, 100.0);
select(&mut s, &[a, b]);
let group = NodeId(s.execute("livePaint.make", &json!({})).unwrap()["id"].as_u64().unwrap());
let node = s.doc().unwrap().doc.node(group).unwrap();
let faces: Vec<_> = vectorcraft_tools::builder::faces(node).iter().map(|n| n.id).collect();
let edges: Vec<_> = vectorcraft_tools::builder::edges(node).iter().map(|n| n.id).collect();
assert!(faces.len() >= 2);
assert!(edges.len() >= 2);
refuse_row_parts_and_group_whole(&mut s, group, &[faces.clone(), edges.clone()]);
let node = s.doc().unwrap().doc.node(group).unwrap();
assert_eq!(vectorcraft_tools::builder::faces(node).iter().map(|n| n.id).collect::<Vec<_>>(), faces);
assert_eq!(vectorcraft_tools::builder::edges(node).iter().map(|n| n.id).collect::<Vec<_>>(), edges);
}
#[test]
fn group_rows_refuses_live_graph_descendants_but_groups_the_whole_graph() {
let mut s = session();
let params = json!({"type": "column", "x": 20, "y": 20, "width": 200, "height": 200, "csv": ",Series\nA,3\nB,5"});
let graph = NodeId(s.execute("graph.create", &params).unwrap()["id"].as_u64().unwrap());
let node = s.doc().unwrap().doc.node(graph).unwrap();
let series = node.children().unwrap().iter().find(|n| n.extras().series_index == Some(0)).unwrap();
let marks: Vec<_> = series.children().unwrap().iter().take(2).map(|n| n.id).collect();
assert_eq!(marks.len(), 2);
let direct = children(&s, graph);
refuse_row_parts_and_group_whole(&mut s, graph, &[marks, direct]);
assert!(s.doc().unwrap().doc.node(graph).unwrap().extras().graph.is_some());
}
#[test]
fn group_rows_refuses_explicitly_selected_live_blend_keys() {
let mut s = session();
let a = rect(&mut s, 0.0, 0.0, 20.0, 20.0);
let b = rect(&mut s, 30.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 c = rect(&mut s, 60.0, 0.0, 20.0, 20.0);
let d = rect(&mut s, 90.0, 0.0, 20.0, 20.0);
select(&mut s, &[a, b]);
refuses(&mut s, "addon.arrange.groupRows", &[json!({})]);
select(&mut s, &[a, b, c, d]);
refuses(&mut s, "addon.arrange.groupRows", &[json!({})]);
assert_eq!(children(&s, blend), [a, b]);
}
#[test]
fn group_rows_refuses_explicitly_selected_shaper_children() {
let mut s = session();
let a = rect(&mut s, 0.0, 0.0, 100.0, 100.0);
let b = rect(&mut s, 50.0, 0.0, 100.0, 100.0);
select(&mut s, &[a, b]);
let shaper = NodeId(s.execute("shaper.scribble", &json!({"points": [[25, 25], [125, 25]]})).unwrap()["id"].as_u64().unwrap());
let members = children(&s, shaper);
assert!(members.len() >= 2);
let sources = members[0];
let face = s
.doc()
.unwrap()
.doc
.node(shaper)
.unwrap()
.children()
.unwrap()
.iter()
.find(|n| n.name.as_deref().is_some_and(|name| name.starts_with(vectorcraft_doc::shaper::FILL_PREFIX)))
.unwrap()
.id;
let c = rect(&mut s, 200.0, 0.0, 20.0, 20.0);
let d = rect(&mut s, 230.0, 0.0, 20.0, 20.0);
for direction in ["row", "column"] {
select(&mut s, &[sources, face]);
refuses(&mut s, "addon.arrange.groupRows", &[json!({"direction": direction})]);
select(&mut s, &[sources, face, c, d]);
refuses(&mut s, "addon.arrange.groupRows", &[json!({"direction": direction})]);
assert_eq!(children(&s, shaper), members);
}
}
#[test]
fn group_rows_refuses_explicitly_selected_live_compound_shape_operands() {
let mut s = session();
let a = rect(&mut s, 0.0, 0.0, 30.0, 30.0);
let b = rect(&mut s, 10.0, 0.0, 30.0, 30.0);
select(&mut s, &[a, b]);
s.execute("object.compoundShape.make", &json!({"mode": "subtract"})).unwrap();
let shape = s.doc().unwrap().selection.objects[0];
let c = rect(&mut s, 200.0, 0.0, 20.0, 20.0);
let d = rect(&mut s, 230.0, 0.0, 20.0, 20.0);
for direction in ["row", "column"] {
select(&mut s, &[a, b]);
refuses(&mut s, "addon.arrange.groupRows", &[json!({"direction": direction})]);
select(&mut s, &[a, b, c, d]);
refuses(&mut s, "addon.arrange.groupRows", &[json!({"direction": direction})]);
assert_eq!(children(&s, shape), [a, b]);
}
}
#[test]
fn group_rows_skips_explicitly_selected_locked_and_hidden_objects() {
for command in ["object.lock", "object.hide"] {
let mut s = session();
let a = rect(&mut s, 0.0, 0.0, 20.0, 20.0);
let b = rect(&mut s, 30.0, 0.0, 20.0, 20.0);
let c = rect(&mut s, 60.0, 0.0, 20.0, 20.0);
select(&mut s, &[b]);
s.execute(command, &json!({})).unwrap();
select(&mut s, &[a, b, c]);
assert!(s.doc().unwrap().selection.objects.contains(&b));
let r = s.execute("addon.arrange.groupRows", &json!({})).unwrap();
let groups = ids_of(&r["groups"]);
assert_eq!(r["grouped"], json!(2));
assert_eq!(children(&s, groups[0]), [a, c]);
assert_eq!(s.doc().unwrap().doc.parent_of(b), Some(s.doc().unwrap().doc.layers[0].id));
}
}
#[test]
fn group_rows_leaves_objects_outside_all_artboards_ungrouped() {
for direction in ["row", "column"] {
let mut s = session();
let a = rect(&mut s, 500.0, 500.0, 20.0, 20.0);
let b = rect(&mut s, 505.0, 505.0, 20.0, 20.0);
select(&mut s, &[a, b]);
let (before, n) = (s.doc().unwrap().doc.clone(), steps(&s));
let r = s.execute("addon.arrange.groupRows", &json!({"direction": direction})).unwrap();
assert_eq!((r["grouped"].clone(), steps(&s)), (json!(0), n));
assert!(*s.doc().unwrap().doc == *before);
let c = rect(&mut s, 0.0, 0.0, 20.0, 20.0);
let d = rect(&mut s, 5.0, 5.0, 20.0, 20.0);
select(&mut s, &[a, b, c, d]);
let r = s.execute("addon.arrange.groupRows", &json!({"direction": direction})).unwrap();
let groups = ids_of(&r["groups"]);
assert_eq!(r["grouped"], json!(2));
assert_eq!(children(&s, groups[0]), [c, d]);
assert_eq!(layer_children(&s), [a, b, groups[0]]);
let sel = &s.doc().unwrap().selection.objects;
assert!(sel.contains(&a) && sel.contains(&b));
}
}
#[test]
fn group_rows_documents_and_excludes_raster_effects_from_bounds() {
let mut s = session();
let a = rect(&mut s, 0.0, 0.0, 20.0, 20.0);
select(&mut s, &[a]);
s.execute("effect.apply", &json!({"effect": "stylize.dropShadow", "params": {"x": 0, "y": 5, "blur": 0}})).unwrap();
let b = rect(&mut s, 0.0, 21.0, 20.0, 20.0);
select(&mut s, &[a, b]);
let n = steps(&s);
let r = s.execute("addon.arrange.groupRows", &json!({})).unwrap();
assert_eq!((r["grouped"].clone(), steps(&s)), (json!(0), n));
assert_eq!(layer_children(&s), [a, b]);
let spec = super::specs().into_iter().find(|c| c.id == "addon.arrange.groupRows").unwrap();
assert!(spec.params.contains("excludes raster effects"));
}
#[test]
fn group_rows_is_off_with_one_object_skips_locked_ones_and_refuses_bad_params() {
let mut s = session();
let a = rect(&mut s, 0.0, 0.0, 20.0, 20.0);
select(&mut s, &[a]);
assert!(!enabled(&s, "addon.arrange.groupRows"));
let b = rect(&mut s, 30.0, 0.0, 20.0, 20.0);
let c = rect(&mut s, 60.0, 0.0, 20.0, 20.0);
select(&mut s, &[a, b, c]);
assert!(enabled(&s, "addon.arrange.groupRows"));
refuses(
&mut s,
"addon.arrange.groupRows",
&[json!({"direction": "diagonal"}), json!({"direction": 3}), json!({"direction": true}), json!({"direction": null})],
);
select(&mut s, &[b]);
s.execute("object.lock", &json!({})).unwrap();
s.execute("select.all", &json!({})).unwrap();
let r = s.execute("addon.arrange.groupRows", &json!({})).unwrap();
let groups = ids_of(&r["groups"]);
assert_eq!(groups.len(), 1);
assert_eq!(children(&s, groups[0]), [a, c], "the locked object stays out");
assert_eq!(s.doc().unwrap().doc.parent_of(b), Some(s.doc().unwrap().doc.layers[0].id));
}
#[test]
fn group_rows_refuses_non_object_params_without_an_edit() {
let mut s = session();
let a = rect(&mut s, 0.0, 0.0, 20.0, 20.0);
let b = rect(&mut s, 30.0, 0.0, 20.0, 20.0);
select(&mut s, &[a, b]);
let selection = s.doc().unwrap().selection.objects.clone();
refuses(&mut s, "addon.arrange.groupRows", &[json!([]), json!(["row"]), json!("row"), json!(true), json!(3)]);
assert_eq!(s.doc().unwrap().selection.objects, selection);
}
#[test]
fn group_rows_reads_the_symbol_index_once_for_all_members() {
use std::sync::Arc;
use vectorcraft_doc::{Appearance, Document, Node, NodeKind, Symbol};
use vectorcraft_geom::Affine;
let mut d = Document::new(400.0, 300.0);
for i in 0..200 {
let art = Node::path(d.alloc_id(), vectorcraft_geom::shapes::rectangle(Rect::new(0.0, 0.0, 10.0, 10.0)), Appearance::default_art());
d.symbols.push(Symbol { dynamic: false, name: format!("Mark {i}"), art: Arc::new(art) });
}
let layer = d.layers[0].id;
let ids: Vec<_> = (0..8)
.map(|i| {
let xf = Affine::translate((0.0, f64::from(i) * 20.0));
let n = Node::new(d.alloc_id(), NodeKind::SymbolInstance { symbol: format!("Mark {i}"), xf });
d.insert(Some(layer), usize::MAX, n).unwrap()
})
.collect();
let symbol_count = d.symbols.len();
let mut s = Session::new();
s.add_document(d, None);
select(&mut s, &ids);
let n = steps(&s);
let before = vectorcraft_doc::symbols_read();
let r = s.execute("addon.arrange.groupRows", &json!({})).unwrap();
let read = vectorcraft_doc::symbols_read() - before;
assert!(read <= symbol_count, "{read} symbols read, {symbol_count} in the document");
assert_eq!((r["grouped"].clone(), steps(&s)), (json!(0), n));
assert_eq!(layer_children(&s), ids);
}
#[test]
fn group_rows_sorts_many_objects_into_rows() {
// 20000 objects in pairs up the page, the front one of each pair starting higher: each pair overlaps,
// neighboring pairs only touch.
let items: Vec<(u8, (f64, f64))> = (0..20_000)
.map(|i| {
let top = (10_000 - i / 2) as f64 * 10.0;
(0, (if i % 2 == 0 { top + 1.0 } else { top }, top + 10.0))
})
.collect();
let rows = super::rows_of(&items);
assert_eq!(rows.len(), 10_000);
assert!(rows.iter().all(|r| r.len() == 2 && r[1] == r[0] + 1), "pairs, in the order given");
assert_eq!(rows.first(), Some(&vec![19_998, 19_999]), "the top row first");
}
#[test]
fn group_rows_keeps_a_flat_object_on_a_row_edge_apart_in_either_order() {
// An extent with no height at the top edge of another only touches it, whichever is in front.
let flat_behind: Vec<(u8, (f64, f64))> = vec![(0, (0.0, 0.0)), (0, (0.0, 10.0))];
let flat_in_front: Vec<(u8, (f64, f64))> = vec![(0, (0.0, 10.0)), (0, (0.0, 0.0))];
assert!(super::rows_of(&flat_behind).is_empty());
assert!(super::rows_of(&flat_in_front).is_empty(), "{:?}", super::rows_of(&flat_in_front));
// Inside the row, it joins.
assert_eq!(super::rows_of(&[(0u8, (0.0, 10.0)), (0, (5.0, 5.0))]), vec![vec![0, 1]]);
// A start of -0.0 is the same edge as 0.0, so the flat extent there still only touches.
let negative_zero: Vec<(u8, (f64, f64))> = vec![(0, (0.0, 0.0)), (0, (-0.0, 10.0))];
assert!(super::rows_of(&negative_zero).is_empty(), "{:?}", super::rows_of(&negative_zero));
}
fn opacity(s: &Session, id: NodeId) -> f32 {
s.doc().unwrap().doc.node(id).unwrap().opacity
}
@@ -6,6 +6,7 @@
pub(super) const ALLOWED: &[&str] = &[
"addon.arrange.grid",
"addon.arrange.groupOverlapping",
"addon.arrange.groupRows",
"addon.arrange.markBounds",
"addon.arrange.match",
"addon.arrange.offset",
+2
View File
@@ -1034,6 +1034,8 @@ fn structured_junk() {
("addon.arrange.match", json!({"source": "key", "rotate": true})),
("addon.arrange.match", json!({"source": "nope", "size": 3, "rotate": "x", "reference": u64::MAX})),
("addon.arrange.groupOverlapping", json!({"ids": "x", "junk": f64::MAX})),
("addon.arrange.groupRows", json!({"direction": "column"})),
("addon.arrange.groupRows", json!({"direction": "diagonal", "junk": f64::MAX})),
("addon.arrange.randomizeOpacity", json!({"min": 0, "max": 100, "seed": u64::MAX})),
("addon.arrange.randomizeOpacity", json!({"min": f64::MAX, "max": -1e308, "seed": -1, "ids": [u64::MAX]})),
("addon.arrange.randomizeOpacity", json!({"min": 100, "max": 0, "seed": 1e308, "ids": []})),
+1 -1
View File
@@ -1531,7 +1531,7 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[
"ui.menuDialog",
"Menu Dialog",
"",
"{command: object.move|object.rotate|object.scale|object.reflect|object.shear|object.transformEach|path.average|path.averageJoin|object.path.offsetPath|object.path.simplify|object.path.smooth|object.path.splitIntoGrid|object.vectorHalftone|object.stepAndRepeat|artboard.rearrange|artboard.rename|object.envelope.makeWithWarp|object.envelope.resetWithWarp|object.envelope.makeWithMesh|object.envelope.resetWithMesh|object.envelope.options|addon.arrange.grid|addon.arrange.offset|addon.arrange.replace|addon.arrange.size|addon.arrange.match|addon.packaging.setFoldAngle|addon.pathtools.cornerSet|addon.pathtools.divideDashes|addon.pathtools.bridge|addon.pathtools.tangentCircle|addon.type.textTweaker|addon.color.swatchLegend|addon.arrange.randomizeOpacity|addon.arrange.sort|addon.arrange.markBounds|addon.color.applyNearestSwatch|addon.select.byArtboards|addon.select.editPointsOnly|type.smartPunctuation|variable.define|variable.rename|variable.bind|dataset.new|dataset.set|dataset.rename|dataset.select} open the dialog that command's menu item opens (its `key` in ui.inspect is the command id, except `transformEach` for object.transformEach, `envelopeWarp` for object.envelope.makeWithWarp and object.envelope.resetWithWarp, `envelopeMesh` for object.envelope.makeWithMesh and object.envelope.resetWithMesh, `variables` for variable.define and variable.rename and variable.bind and dataset.new and dataset.set and dataset.rename and dataset.select, `envelopeOptions` for object.envelope.options, `smoothSlider` for object.path.smooth, and `simplifySlider` for object.path.simplify; the dialogs of addon.color.applyNearestSwatch and addon.select.byArtboards have no `key`; smoothSlider and simplifySlider are the sliders over the canvas, with field `level`, and object.path.simplify opens its dialog `object.path.simplify` instead once OK in that dialog keeps the settings (`retain`); Set Fold Angle's `angle` is the selected fold lines' angle, and it is refused while the selection has no fold line it can change; Scale and Transform Each have `corners` and `strokes`, from the preferences, which OK updates; Transform Each opens on the values it was last confirmed with (not `copy`), and its Copy button confirms with `copy: true`; the envelope dialogs start from the selected envelope, Make opens as Reset (`reset: true`) while one is selected; variable.rename opens only while the document has a variable, and dataset.set and dataset.rename only while it has a data set, and otherwise the status bar says why; ui.dialog.set, ui.dialog.confirm and ui.dialog.cancel take the dialog's `id` from ui.inspect, or `top`, not its `key`)",
"{command: object.move|object.rotate|object.scale|object.reflect|object.shear|object.transformEach|path.average|path.averageJoin|object.path.offsetPath|object.path.simplify|object.path.smooth|object.path.splitIntoGrid|object.vectorHalftone|object.stepAndRepeat|artboard.rearrange|artboard.rename|object.envelope.makeWithWarp|object.envelope.resetWithWarp|object.envelope.makeWithMesh|object.envelope.resetWithMesh|object.envelope.options|addon.arrange.grid|addon.arrange.offset|addon.arrange.replace|addon.arrange.size|addon.arrange.match|addon.arrange.groupRows|addon.packaging.setFoldAngle|addon.pathtools.cornerSet|addon.pathtools.divideDashes|addon.pathtools.bridge|addon.pathtools.tangentCircle|addon.type.textTweaker|addon.color.swatchLegend|addon.arrange.randomizeOpacity|addon.arrange.sort|addon.arrange.markBounds|addon.color.applyNearestSwatch|addon.select.byArtboards|addon.select.editPointsOnly|type.smartPunctuation|variable.define|variable.rename|variable.bind|dataset.new|dataset.set|dataset.rename|dataset.select} open the dialog that command's menu item opens (its `key` in ui.inspect is the command id, except `transformEach` for object.transformEach, `envelopeWarp` for object.envelope.makeWithWarp and object.envelope.resetWithWarp, `envelopeMesh` for object.envelope.makeWithMesh and object.envelope.resetWithMesh, `variables` for variable.define and variable.rename and variable.bind and dataset.new and dataset.set and dataset.rename and dataset.select, `envelopeOptions` for object.envelope.options, `smoothSlider` for object.path.smooth, and `simplifySlider` for object.path.simplify; the dialogs of addon.color.applyNearestSwatch and addon.select.byArtboards have no `key`; smoothSlider and simplifySlider are the sliders over the canvas, with field `level`, and object.path.simplify opens its dialog `object.path.simplify` instead once OK in that dialog keeps the settings (`retain`); Set Fold Angle's `angle` is the selected fold lines' angle, and it is refused while the selection has no fold line it can change; Scale and Transform Each have `corners` and `strokes`, from the preferences, which OK updates; Transform Each opens on the values it was last confirmed with (not `copy`), and its Copy button confirms with `copy: true`; the envelope dialogs start from the selected envelope, Make opens as Reset (`reset: true`) while one is selected; variable.rename opens only while the document has a variable, and dataset.set and dataset.rename only while it has a data set, and otherwise the status bar says why; ui.dialog.set, ui.dialog.confirm and ui.dialog.cancel take the dialog's `id` from ui.inspect, or `top`, not its `key`)",
),
(
"ui.widthPointEdit",
+19 -4
View File
@@ -1,7 +1,7 @@
//! Arrange Tools in the interface: its submenu (Object › Plug-ins › Arrange Tools); the dialogs of
//! Arrange in Grid, Offset Objects, Replace with Top Object, Set Size of Each, Match Objects, Randomize Opacity,
//! Sort Objects and Mark Bounds of Each, which preview on the canvas and run their `addon.arrange.*` command on OK;
//! Group Overlapping Objects; and Zoom to Selection ([`ZOOM`]), which fits the active view to the selection.
//! Arrange in Grid, Offset Objects, Replace with Top Object, Set Size of Each, Match Objects, Group by Row, Randomize
//! Opacity, Sort Objects and Mark Bounds of Each, which preview on the canvas and run their `addon.arrange.*` command
//! on OK; Group Overlapping Objects; and Zoom to Selection ([`ZOOM`]), which fits the active view to the selection.
use std::borrow::Cow;
@@ -26,16 +26,18 @@ const OFFSET: &str = "addon.arrange.offset";
const REPLACE: &str = "addon.arrange.replace";
const SIZE: &str = "addon.arrange.size";
const MATCH: &str = "addon.arrange.match";
const ROWS: &str = "addon.arrange.groupRows";
const OPACITY: &str = "addon.arrange.randomizeOpacity";
const SORT: &str = "addon.arrange.sort";
const MARKS: &str = "addon.arrange.markBounds";
/// Each dialog's command and heading.
const DIALOGS: [(&str, &str); 8] = [
const DIALOGS: [(&str, &str); 9] = [
(GRID, "Arrange in Grid"),
(OFFSET, "Offset Objects"),
(REPLACE, "Replace with Top Object"),
(SIZE, "Set Size of Each"),
(MATCH, "Match Objects"),
(ROWS, "Group by Row"),
(OPACITY, "Randomize Opacity"),
(SORT, "Sort Objects"),
(MARKS, "Mark Bounds of Each"),
@@ -72,6 +74,7 @@ pub fn menu() -> Vec<Node> {
c("Set Size of Each…", SIZE),
c("Match Objects…", MATCH),
cp("Group Overlapping Objects", "addon.arrange.groupOverlapping", json!({})),
c("Group by Row…", ROWS),
c("Randomize Opacity…", OPACITY),
c("Sort Objects…", SORT),
c("Mark Bounds of Each…", MARKS),
@@ -85,6 +88,7 @@ static OFFSET_SPEC: Spec = Spec { command: OFFSET, params: offset_params, found:
static REPLACE_SPEC: Spec = Spec { command: REPLACE, params: replace_params, found: None };
static SIZE_SPEC: Spec = Spec { command: SIZE, params: size_params, found: None };
static MATCH_SPEC: Spec = Spec { command: MATCH, params: match_params, found: None };
static ROWS_SPEC: Spec = Spec { command: ROWS, params: group_rows_params, found: None };
static OPACITY_SPEC: Spec = Spec { command: OPACITY, params: opacity_params, found: None };
static SORT_SPEC: Spec = Spec { command: SORT, params: sort_params, found: None };
static MARKS_SPEC: Spec = Spec { command: MARKS, params: marks_params, found: None };
@@ -160,6 +164,11 @@ fn size_rows(lengths: LengthUnits) -> Vec<Param> {
]
}
fn group_rows_rows() -> Vec<Param> {
let directions = [("row", "Rows"), ("column", "Columns")];
vec![choice("direction", "Group By:", &directions, "row")]
}
fn match_rows() -> Vec<Param> {
let sources = [("key", "Key Object"), ("top", "Top Object"), ("bottom", "Bottom Object")];
let sizes = [("none", "None"), ("width", "Width"), ("height", "Height"), ("both", "Width and Height")];
@@ -233,6 +242,10 @@ fn size_params(fields: &DialogFields) -> Value {
Value::Object(params)
}
fn group_rows_params(fields: &DialogFields) -> Value {
Value::Object(form::json_of(&group_rows_rows(), fields))
}
fn match_params(fields: &DialogFields) -> Value {
Value::Object(form::json_of(&match_rows(), fields))
}
@@ -263,6 +276,7 @@ pub(crate) fn open(app: &mut VectorcraftApp, id: &str) -> Option<Result<Value, S
),
OFFSET => (offset_rows(lengths), json!({ "direction": "row", "gap": 10, "order": "stacking", "reverse": false })),
REPLACE => (replace_rows(), json!({ "fit": "keep", "keep": false, "scaleStrokes": strokes })),
ROWS => (group_rows_rows(), json!({ "direction": "row" })),
// The key object while the selection has one, else the top object.
MATCH => (
match_rows(),
@@ -300,6 +314,7 @@ pub(crate) fn open(app: &mut VectorcraftApp, id: &str) -> Option<Result<Value, S
GRID => super::dialogs::open(app, &GRID_SPEC, fields, move |fields| dialog(GRID, grid_rows(lengths)).values(Bind::bound(fields))),
OFFSET => super::dialogs::open(app, &OFFSET_SPEC, fields, move |fields| dialog(OFFSET, offset_rows(lengths)).values(Bind::bound(fields))),
REPLACE => super::dialogs::open(app, &REPLACE_SPEC, fields, |fields| dialog(REPLACE, replace_rows()).values(Bind::bound(fields))),
ROWS => super::dialogs::open(app, &ROWS_SPEC, fields, |fields| dialog(ROWS, group_rows_rows()).values(Bind::bound(fields))),
MATCH => super::dialogs::open(app, &MATCH_SPEC, fields, move |fields| {
let chosen = fields.text("size").is_some_and(|size| size != "none")
|| fields.bool("rotate") == Some(true)
@@ -169,6 +169,64 @@ fn stacking(panel: &Harness) -> Vec<NodeId> {
panel.app().session.doc().unwrap().doc.layers[0].children().unwrap().iter().map(|n| n.id).collect()
}
/// [`app`] with a third rectangle, c, in b's row and a's column; all three selected.
fn rows_app() -> (VectorcraftApp, NodeId, NodeId, NodeId) {
let (mut app, a, b) = app();
let c = NodeId(app.run("shape.rectangle", json!({"x": 10, "y": 100, "width": 20, "height": 20})).unwrap()["id"].as_u64().unwrap());
app.run("select.all", json!({})).unwrap();
(app, a, b, c)
}
fn parent(panel: &Harness, id: NodeId) -> Option<NodeId> {
panel.app().session.doc().unwrap().doc.parent_of(id)
}
#[test]
fn real_group_by_row_keyboard_choice_reaches_the_preview_and_ok_groups_as_one_step() {
let (app, a, b, c) = rows_app();
let n = steps(&app);
let mut panel = Harness::new(app, crate::tests::picks::dialogs);
click(&mut panel.app(), "Group by Row…");
panel.frame();
let layer = panel.app().session.doc().unwrap().doc.layers[0].id;
// Rows: b and c share one, a is alone in its own.
assert_eq!(parent(&panel, b), parent(&panel, c), "the preview groups b's row");
assert_ne!(parent(&panel, b), Some(layer));
assert_eq!(parent(&panel, a), Some(layer));
panel.click_role("Group By", Role::COMBO_BOX);
panel.key(egui::Key::ArrowDown, egui::Modifiers::NONE);
panel.key(egui::Key::Enter, egui::Modifiers::NONE);
panel.frame();
let id = host::dialog_id(&panel.app());
assert_eq!(host::read(&panel.app(), id, |f| f.text("direction").map(str::to_owned)), Some("column".to_owned()));
// Columns: a and c share one, b is alone in its own.
assert_eq!(parent(&panel, a), parent(&panel, c), "the preview follows the keyboard choice");
assert_ne!(parent(&panel, a), Some(layer));
assert_eq!(parent(&panel, b), Some(layer));
panel.click("OK");
panel.frame();
let group = parent(&panel, a).unwrap();
assert_eq!(stacking(&panel), vec![b, group], "the group takes c's place, in front of b");
assert_eq!(parent(&panel, c), Some(group));
assert_eq!(steps(&panel.app()), n + 1, "one undo step");
assert!(!panel.app().any_dialog_open());
}
#[test]
fn real_group_by_row_cancel_leaves_the_objects_ungrouped() {
let (app, a, b, c) = rows_app();
let n = steps(&app);
let mut panel = Harness::new(app, crate::tests::picks::dialogs);
click(&mut panel.app(), "Group by Row…");
panel.frame();
assert_eq!(stacking(&panel).len(), 2, "the preview groups b and c");
panel.click("Cancel");
panel.frame();
assert_eq!(stacking(&panel), vec![a, b, c]);
assert_eq!(steps(&panel.app()), n);
assert!(!panel.app().any_dialog_open());
}
#[test]
fn real_replace_edits_reach_the_preview_and_confirmed_copies() {
let (app, a, b) = app();
+1 -1
View File
@@ -1532,7 +1532,7 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[
"ui.menuDialog",
"Menu Dialog",
"",
"{command: object.move|object.rotate|object.scale|object.reflect|object.shear|object.transformEach|path.average|path.averageJoin|object.path.offsetPath|object.path.simplify|object.path.smooth|object.path.splitIntoGrid|object.vectorHalftone|object.stepAndRepeat|artboard.rearrange|artboard.rename|object.envelope.makeWithWarp|object.envelope.resetWithWarp|object.envelope.makeWithMesh|object.envelope.resetWithMesh|object.envelope.options|addon.arrange.grid|addon.arrange.offset|addon.arrange.replace|addon.arrange.size|addon.arrange.match|addon.packaging.setFoldAngle|addon.pathtools.cornerSet|addon.pathtools.divideDashes|addon.pathtools.bridge|addon.pathtools.tangentCircle|addon.type.textTweaker|addon.color.swatchLegend|addon.arrange.randomizeOpacity|addon.arrange.sort|addon.arrange.markBounds|addon.color.applyNearestSwatch|addon.select.byArtboards|addon.select.editPointsOnly|type.smartPunctuation|variable.define|variable.rename|variable.bind|dataset.new|dataset.set|dataset.rename|dataset.select} open the dialog that command's menu item opens (its `key` in ui.inspect is the command id, except `transformEach` for object.transformEach, `envelopeWarp` for object.envelope.makeWithWarp and object.envelope.resetWithWarp, `envelopeMesh` for object.envelope.makeWithMesh and object.envelope.resetWithMesh, `variables` for variable.define and variable.rename and variable.bind and dataset.new and dataset.set and dataset.rename and dataset.select, `envelopeOptions` for object.envelope.options, `smoothSlider` for object.path.smooth, and `simplifySlider` for object.path.simplify; the dialogs of addon.color.applyNearestSwatch and addon.select.byArtboards have no `key`; smoothSlider and simplifySlider are the sliders over the canvas, with field `level`, and object.path.simplify opens its dialog `object.path.simplify` instead once OK in that dialog keeps the settings (`retain`); Set Fold Angle's `angle` is the selected fold lines' angle, and it is refused while the selection has no fold line it can change; Scale and Transform Each have `corners` and `strokes`, from the preferences, which OK updates; Transform Each opens on the values it was last confirmed with (not `copy`), and its Copy button confirms with `copy: true`; the envelope dialogs start from the selected envelope, Make opens as Reset (`reset: true`) while one is selected; variable.rename opens only while the document has a variable, and dataset.set and dataset.rename only while it has a data set, and otherwise the status bar says why; ui.dialog.set, ui.dialog.confirm and ui.dialog.cancel take the dialog's `id` from ui.inspect, or `top`, not its `key`)",
"{command: object.move|object.rotate|object.scale|object.reflect|object.shear|object.transformEach|path.average|path.averageJoin|object.path.offsetPath|object.path.simplify|object.path.smooth|object.path.splitIntoGrid|object.vectorHalftone|object.stepAndRepeat|artboard.rearrange|artboard.rename|object.envelope.makeWithWarp|object.envelope.resetWithWarp|object.envelope.makeWithMesh|object.envelope.resetWithMesh|object.envelope.options|addon.arrange.grid|addon.arrange.offset|addon.arrange.replace|addon.arrange.size|addon.arrange.match|addon.arrange.groupRows|addon.packaging.setFoldAngle|addon.pathtools.cornerSet|addon.pathtools.divideDashes|addon.pathtools.bridge|addon.pathtools.tangentCircle|addon.type.textTweaker|addon.color.swatchLegend|addon.arrange.randomizeOpacity|addon.arrange.sort|addon.arrange.markBounds|addon.color.applyNearestSwatch|addon.select.byArtboards|addon.select.editPointsOnly|type.smartPunctuation|variable.define|variable.rename|variable.bind|dataset.new|dataset.set|dataset.rename|dataset.select} open the dialog that command's menu item opens (its `key` in ui.inspect is the command id, except `transformEach` for object.transformEach, `envelopeWarp` for object.envelope.makeWithWarp and object.envelope.resetWithWarp, `envelopeMesh` for object.envelope.makeWithMesh and object.envelope.resetWithMesh, `variables` for variable.define and variable.rename and variable.bind and dataset.new and dataset.set and dataset.rename and dataset.select, `envelopeOptions` for object.envelope.options, `smoothSlider` for object.path.smooth, and `simplifySlider` for object.path.simplify; the dialogs of addon.color.applyNearestSwatch and addon.select.byArtboards have no `key`; smoothSlider and simplifySlider are the sliders over the canvas, with field `level`, and object.path.simplify opens its dialog `object.path.simplify` instead once OK in that dialog keeps the settings (`retain`); Set Fold Angle's `angle` is the selected fold lines' angle, and it is refused while the selection has no fold line it can change; Scale and Transform Each have `corners` and `strokes`, from the preferences, which OK updates; Transform Each opens on the values it was last confirmed with (not `copy`), and its Copy button confirms with `copy: true`; the envelope dialogs start from the selected envelope, Make opens as Reset (`reset: true`) while one is selected; variable.rename opens only while the document has a variable, and dataset.set and dataset.rename only while it has a data set, and otherwise the status bar says why; ui.dialog.set, ui.dialog.confirm and ui.dialog.cancel take the dialog's `id` from ui.inspect, or `top`, not its `key`)",
),
(
"ui.widthPointEdit",
+6 -2
View File
@@ -17743,7 +17743,8 @@ images and patterns keep their colours. → `{changed, swatches: [the document s
Arrange Tools is a built-in add-on that lays out, swaps, replaces and sizes selected objects: its commands are
`addon.arrange.*`, and in the desktop app it lives in Object › Plug-ins › Arrange Tools. Each command acts on the
top-level selected objects and is one undo step; a run that moves nothing makes no step. Places and sizes are measured
as `object.setBounds` measures them (Use Preview Bounds), except Arrange in Grid and Offset Objects, which use visual bounds.
as `object.setBounds` measures them (Use Preview Bounds), except Arrange in Grid and Offset Objects, which use visual bounds, and Group by Row, which always uses visual bounds
with strokes and vector effects included and raster effects left out (see its row).
| Command | Parameters (default) | Does |
|---|---|---|
@@ -17754,6 +17755,7 @@ as `object.setBounds` measures them (Use Preview Bounds), except Arrange in Grid
| `addon.arrange.size` | `width`, `height` pt, 0.001…1000000 (at least one); `proportional` (false: a side not given stays; true: it follows the given one in proportion); `reference` 0…8 (4, the centre); `scaleStrokes` | Gives every selected object that width and height, keeping its reference point in place (the 9-point grid row by row from the top-left). |
| `addon.arrange.match` | `source`: `key` (the key object, `select.key`), `top` (the frontmost selected object), `bottom` (the backmost) (the key object when the selection has one, else `top`); `size`: `none`, `width` (the height follows in proportion), `height` (the width follows in proportion), `both` (`none`); `rotate` (false); `stacking` (false); `reference` 0…8 (4, the center); `scaleStrokes`; `patterns` (the Transform Pattern Tiles preference); at least one of `size`, `rotate` and `stacking` | Makes the other selected objects (at most 20000) match the source, which stays as it is. `size` gives each one the source's width, height or both, measured in each object's own bounding-box frame; `rotate` turns each one to the source's bounding-box angle; both keep each object's reference point in place. `stacking` puts the others directly above the source, in its layer or group, in the order they had. `source: "key"` without a key object, and a `size` that takes a width or a height the source or a target does not have, and a `stacking` match that would move a clipping path, are refused. To match places, use `object.align {to: "key"}`. → `{source, count}` |
| `addon.arrange.groupOverlapping` | none | Groups the selected objects (at most 20000) wherever their visual bounds overlap or touch, chains included: when A overlaps B and B overlaps C, all three go in one group. Only objects in the same layer or group are grouped together; objects that overlap nothing stay as they are. Each new group goes where its frontmost member was in the stacking order, and the groups and the objects left alone stay selected; with nothing overlapping it makes no step. Needs two objects or more. → `{groups: [id…], grouped}` (how many objects went into groups) |
| `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 a selection with nothing to mark is an error that makes no step. The marks are selected. → `{ids, count}` |
@@ -17767,12 +17769,14 @@ Match Objects… opens a dialog of its own in the same way, keyed by its command
parameters, with Preview; it opens on the key object when the selection has one, else on the top object, and OK is
off while nothing is chosen to match or the source is the key object and there is none.
Offset Objects… opens one the same way (`ui.menuDialog {command: "addon.arrange.offset"}`), with Direction, Gap, Order
and Reverse Order. Mark Bounds of Each… opens a dialog of the command's parameters with Preview; Length is off unless
and Reverse Order. Group by Row… opens one too (`ui.menuDialog {command: "addon.arrange.groupRows"}`), with Group By
(Rows or Columns). Mark Bounds of Each… opens a dialog of the command's parameters with Preview; Length is off unless
Draw is Corner Marks.
```json
{"name":"run_command","arguments":{"command":"addon.arrange.grid","params":{"columns":4,"gapX":12,"gapY":12}}}
{"name":"run_command","arguments":{"command":"addon.arrange.offset","params":{"direction":"column","gap":6,"order":"position"}}}
{"name":"run_command","arguments":{"command":"addon.arrange.groupRows","params":{"direction":"row"}}}
{"name":"run_command","arguments":{"command":"addon.arrange.replace","params":{"fit":"proportional"}}}
{"name":"run_command","arguments":{"command":"addon.arrange.size","params":{"width":72,"proportional":true}}}
{"name":"run_command","arguments":{"command":"addon.arrange.match","params":{"source":"key","size":"both","rotate":true}}}
+4
View File
@@ -3167,6 +3167,10 @@ A VectorCraft addition, so no area score moves. Object › Plug-ins › Arrange
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. 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` 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)
A VectorCraft addition, so no area score moves. Object › Plug-ins › Arrange Tools › Group by Row… puts the top-level selected objects (at most 20000) into one group for each row: an object joins a row when its visual bounds, a clipping group's by its mask, overlap the row from top to bottom. Group By Columns does the same from left to right. Extents that only touch stay apart, an object that overlaps two rows joins them, and only objects in the same layer or group and on the same artboard share a row; an object alone in its row stays as it is. Each new group takes its frontmost member's place in the stacking order, and the groups and the objects left alone stay selected. One undo step; no step when no row holds two objects. Tests: `group_rows_*` in `cmd::addons::arrange::tests` in `vectorcraft-engine` (rows and loners, columns, an object spanning two rows, layers and artboards kept apart, strokes and clipping groups, locked objects left out, bad params, 20000 objects), `real_group_by_row_*` in `vectorcraft-ui-egui` and `command_sweep`. Commands: `docs/mcp.md` › Arrange Tools add-on.
## Type Tools add-on: Text Tweaker (2026-11-03)
A VectorCraft addition, not a feature of the reference app, so no area score moves. Object › Plug-ins › Type Tools › Text Tweaker… gives one character attribute (size, baseline shift, character rotation, horizontal or vertical scale, tracking, leading or stroke weight) to the selected characters letter by letter, from a start value to an end value along a straight ramp, an ease in and out, a bow, a spike or at random with a seed, while the text stays live and editable (#4924). With Block enabled, a leading ramp sets Line Gap from the first changed character instead of varying leading across the text. Values are set as the Character panel sets them, in its units and ranges, so scaled type takes the sizes shown; spaces and line breaks are skipped unless asked for, each type object gets its own ramp, the range is the Type tool's selection or all the text of the selected type objects, and the run is one undo step from a dialog with Preview. Tests: `cmd::addons::typetools::tests` in `vectorcraft-engine` (each shape, each attribute, skipped spaces, ranges, one ramp per object, seeded random values, scaled type, one undo step, bad params refused), `addons::typetools::tests` in `vectorcraft-ui-egui` (the submenu, the dialog, Preview and Cancel, OK) and `command_sweep`. Commands: `docs/mcp.md` › Type Tools add-on.
+1
View File
@@ -576,6 +576,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 › 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 |
| 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 |
| 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 |
| 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 |
| 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 |
| 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 |
| Document Tools add-on (VectorCraft addition): Object › Plug-ins › Document Tools › Batch Trace Folder asks for a folder of images, then a destination folder, traces each image with a preset (optionally expanded) and saves it there as `.vectorcraft`, `.svg`, `.pdf`, `.ai` or `.eps` under its own name (taken names numbered, nothing replaced), closing each image again; the status bar counts the images traced and those that couldn't be; off on the web | done | #4921; `addon.document.batchTraceFolder`, `crates/engine/src/cmd/addons/document/batch_trace.rs`, `crates/ui-egui/src/addons/document.rs` and their tests; not a feature of the reference app |