From 2960e55b6c38ff109e56ce1879a142a4ee929294 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sun, 29 Nov 2026 15:40:43 -0800 Subject: [PATCH] Match Objects: a stacking match keeps clipping paths and settles Intertwine groups Merging main made DIALOGS one entry short: Offset Objects and Match Objects both joined it, so vectorcraft-ui-egui did not compile. The table now declares seven entries. A stacking match moved a clipping path out of its clip position and could move a member out of an Intertwine group with its old overlap tiers. It now refuses to move a clipping path, refuses a destination that would nest Intertwine art, and clears the tiers of members that leave their group. A stacking or rotate-only match no longer needs bounds on the source. A size match measures each target after it is sized and turned, in its final frame, and is refused when a target can't take the requested size, instead of reporting success with the size unchanged. A target with no bounds that needs to turn is refused. --- crates/engine/src/cmd/addons/arrange.rs | 74 ++++++-- crates/engine/src/cmd/addons/arrange/tests.rs | 173 +++++++++++++++++- crates/ui-egui/src/addons/arrange.rs | 2 +- docs/mcp.md | 2 +- docs/target-app-parity.md | 2 +- 5 files changed, 238 insertions(+), 15 deletions(-) diff --git a/crates/engine/src/cmd/addons/arrange.rs b/crates/engine/src/cmd/addons/arrange.rs index 6ded16116a..136ec7ffbf 100644 --- a/crates/engine/src/cmd/addons/arrange.rs +++ b/crates/engine/src/cmd/addons/arrange.rs @@ -95,7 +95,7 @@ pub fn specs() -> Vec { "Match Objects", ["Object", "Plug-ins", "Arrange Tools"], None, - "{source?: \"key\" (the key object, select.key) | \"top\" (the frontmost selected object) | \"bottom\" (the backmost) (default: the key object when the selection has one, else \"top\"), size?: \"none\" | \"width\" (each target takes the source's width, its height following in proportion) | \"height\" (the source's height, the width following in proportion) | \"both\" (the source's width and height, each on its own) (\"none\"), rotate?: false (true: each target turns, clockwise or counter-clockwise, to the source's bounding-box angle), stacking?: false (true: the targets go directly above the source in the stacking order, in its layer or group, in the order they had), reference?: 0..8 (the 9-point grid row by row from the top-left; 4, the center: the point of each target that stays put as it is sized and turned), scaleStrokes?: the Scale Strokes & Effects preference, patterns?: the Transform Pattern Tiles preference (at least one of size, rotate and stacking)} make the other selected objects (the top-level ones, at most 20000) match the source, which stays as it is, as one undo step (none when nothing changes). Sizes are measured and set as object.setBounds measures them (Use Preview Bounds), each in the object's own bounding-box frame; to match places, use object.align {to: \"key\"} → {source, count}", + "{source?: \"key\" (the key object, select.key) | \"top\" (the frontmost selected object) | \"bottom\" (the backmost) (default: the key object when the selection has one, else \"top\"), size?: \"none\" | \"width\" (each target takes the source's width, its height following in proportion) | \"height\" (the source's height, the width following in proportion) | \"both\" (the source's width and height, each on its own) (\"none\"), rotate?: false (true: each target turns, clockwise or counter-clockwise, to the source's bounding-box angle), stacking?: false (true: the targets go directly above the source in the stacking order, in its layer or group, in the order they had), reference?: 0..8 (the 9-point grid row by row from the top-left; 4, the center: the point of each target that stays put as it is sized and turned), scaleStrokes?: the Scale Strokes & Effects preference, patterns?: the Transform Pattern Tiles preference (at least one of size, rotate and stacking)} make the other selected objects (the top-level ones, at most 20000) match the source, which stays as it is, as one undo step (none when nothing changes). Sizes are measured and set as object.setBounds measures them (Use Preview Bounds), each in the object's own bounding-box frame, and a size that a target has no width or height to take is refused, as is a stacking match that would move a clipping path; to match places, use object.align {to: \"key\"} → {source, count}", has_multi, match_objects ), @@ -418,8 +418,13 @@ fn match_objects(s: &mut Session, p: &Value) -> Result { if targets.is_empty() { return Err(bad(C, "select at least two objects")); } - let sb = box_of(s, source)?; - let (w, h) = (sb.rect.width(), sb.rect.height()); + // Only sizing measures the source; a stacking or rotate match doesn't need its bounds. + let (w, h) = if size == "none" { + (0.0, 0.0) + } else { + let sb = box_of(s, source)?; + (sb.rect.width(), sb.rect.height()) + }; let wanted = match size { "width" if w < LEAST => return Err(bad(C, "the source object has no width")), "height" if h < LEAST => return Err(bad(C, "the source object has no height")), @@ -432,7 +437,16 @@ fn match_objects(s: &mut Session, p: &Value) -> Result { let angle = s.doc()?.doc.bbox_angle(&[source]); let mut xfs = Vec::with_capacity(targets.len()); for &id in &targets { - let Some(b) = s.transform_box(&[id]) else { continue }; + let turn = if rotate { vectorcraft_geom::normalize_deg(angle - s.doc()?.doc.bbox_angle(&[id])) } else { 0.0 }; + let Some(b) = s.transform_box(&[id]) else { + if wanted.is_some() { + return Err(bad(C, format!("object {} has no bounds to size", id.0))); + } + if turn.abs() > 1e-9 { + return Err(bad(C, format!("object {} has no bounds to rotate", id.0))); + } + continue; + }; let mut xf = Affine::IDENTITY; if let Some(q) = &wanted { let mut q = q.clone(); @@ -440,13 +454,33 @@ fn match_objects(s: &mut Session, p: &Value) -> Result { q["strokes"] = json!(strokes); xf = object_bounds_transform(s, &q, id)?; } - if rotate { - // Turned about the reference point, which the sizing keeps in place; angles are - // counter-clockwise and y is down. - let turn = vectorcraft_geom::normalize_deg(angle - s.doc()?.doc.bbox_angle(&[id])); - if turn.abs() > 1e-9 { - let at = b.to_doc() * vectorcraft_geom::reference_point(b.rect, reference as usize); - xf = Affine::rotate_about(-turn.to_radians(), at) * xf; + if turn.abs() > 1e-9 { + // Rotation uses the reference point that sizing keeps in place. + let at = b.to_doc() * vectorcraft_geom::reference_point(b.rect, reference as usize); + xf = Affine::rotate_about(-turn.to_radians(), at) * xf; + } + if wanted.is_some() { + let sc = scaling(s, &json!({ "strokes": strokes })); + let d = &s.doc()?.doc; + let symbols = d.symbol_boxes(); + let measure = |xf| { + d.node(id).and_then(|n| { + let mut n = n.clone(); + transform_node(&mut n, xf, sc, true); + let frame = OrientedBox { angle: n.bbox_angle, rect: Rect::ZERO }; + effects::preview::bounds_in_with(&symbols, &n, frame.to_doc().inverse(), s.bounds_measure()) + }) + }; + let misses = |measured: Option| { + measured.is_none_or(|r| match size { + "width" => (r.width() - w).abs() > 1e-6, + "height" => (r.height() - h).abs() > 1e-6, + _ => (r.width() - w).abs() > 1e-6 || (r.height() - h).abs() > 1e-6, + }) + }; + // The sized and turned object, measured in its final frame, must have the size asked for. + if misses(measure(xf)) { + return Err(bad(C, format!("object {} can't take the requested size", id.0))); } } xfs.push((id, xf)); @@ -454,6 +488,22 @@ fn match_objects(s: &mut Session, p: &Value) -> Result { let still = |xf: &Affine| xf.as_coeffs().iter().zip(Affine::IDENTITY.as_coeffs()).all(|(a, b)| (a - b).abs() <= 1e-9); xfs.retain(|(_, xf)| !still(xf)); let restack = stacking && !stacked_above(&s.doc()?.doc, source, &targets); + let (mut placed, mut left) = (vec![], vec![]); + if restack { + let d = &s.doc()?.doc; + // In a clip group or a clipping layer the bottom child is the clipping path: it stays there. + let is_clip = + |id: &NodeId| d.position(*id).is_some_and(|(_, idx, _)| idx == 0) && d.parent_of(*id).and_then(|p| d.node(p)).is_some_and(Node::clips); + if targets.iter().any(is_clip) { + return Err(bad(C, "a clipping path can't change its place in the stacking order")); + } + let parent = d.parent_of(source); + if let Some(what) = targets.iter().filter_map(|id| d.node(*id)).find_map(|n| crate::cmd::intertwine::refused_in(d, parent, n)) { + return Err(bad(C, format!("{what} can't be intertwined"))); + } + placed = targets.iter().map(|i| (*i, d.parent_of(*i))).collect::)>>(); + left = crate::cmd::intertwine::groups_of(d, &targets); + } let count = json!({ "source": source.0, "count": targets.len() }); if xfs.is_empty() && !restack { return Ok(count); @@ -471,6 +521,8 @@ fn match_objects(s: &mut Session, p: &Value) -> Result { if restack { let moved = d.remove_many(&targets)?; d.insert_beside(vec![(source, moved.into_iter().map(Arc::unwrap_or_clone).collect())], false)?; + // Targets moved out of an Intertwine group leave it as ordinary art. + crate::cmd::intertwine::settle_members(d, &placed, &left)?; } Ok(()) })?; diff --git a/crates/engine/src/cmd/addons/arrange/tests.rs b/crates/engine/src/cmd/addons/arrange/tests.rs index ea5d4aca06..265ab50a6a 100644 --- a/crates/engine/src/cmd/addons/arrange/tests.rs +++ b/crates/engine/src/cmd/addons/arrange/tests.rs @@ -424,6 +424,65 @@ fn match_turns_the_others_to_the_sources_angle() { assert!(s.transform_box(&[a]).unwrap().angle.abs() < 1e-6); } +#[test] +fn match_size_and_rotation_measure_pixel_aligned_art_in_its_final_frame() { + for size in ["width", "height", "both"] { + let mut s = session(); + let target = rect(&mut s, 0.0, 0.0, 10.0, 10.0); + select(&mut s, &[target]); + s.execute("object.setPixelAligned", &json!({"on": true})).unwrap(); + let source = rect(&mut s, 100.0, 0.0, 10.5, 10.5); + select(&mut s, &[source]); + s.execute("object.rotate", &json!({"angle": 30})).unwrap(); + let wanted = s.transform_box(&[source]).unwrap(); + select(&mut s, &[target, source]); + s.execute("select.key", &json!({"id": source.0})).unwrap(); + let before = s.doc().unwrap().doc.clone(); + let n = steps(&s); + let r = s.execute("addon.arrange.match", &json!({"size": size, "rotate": true})).unwrap(); + assert_eq!(r, json!({"source": source.0, "count": 1})); + let measured = s.transform_box(&[target]).unwrap(); + assert!((measured.angle - wanted.angle).abs() < 1e-6, "{size}: {measured:?}"); + assert!((measured.rect.width() - wanted.rect.width()).abs() < 1e-6, "{size}: {measured:?}"); + assert!((measured.rect.height() - wanted.rect.height()).abs() < 1e-6, "{size}: {measured:?}"); + assert_eq!(steps(&s), n + 1); + s.execute("edit.undo", &json!({})).unwrap(); + assert!(*s.doc().unwrap().doc == *before); + } +} + +#[test] +fn match_rotation_refuses_a_target_without_bounds_when_its_angle_differs() { + for angle in [0, 30] { + let mut s = session(); + let a = rect(&mut s, 0.0, 0.0, 10.0, 10.0); + let target = NodeId(s.execute("object.group", &json!({})).unwrap()["id"].as_u64().unwrap()); + select(&mut s, &[a]); + s.execute("edit.clear", &json!({})).unwrap(); + let b = rect(&mut s, 100.0, 0.0, 10.0, 10.0); + let source = NodeId(s.execute("object.group", &json!({})).unwrap()["id"].as_u64().unwrap()); + s.execute("object.rotate", &json!({"angle": angle})).unwrap(); + select(&mut s, &[b]); + s.execute("edit.clear", &json!({})).unwrap(); + assert!(s.transform_box(&[target]).is_none()); + assert!(s.transform_box(&[source]).is_none()); + assert!((s.doc().unwrap().doc.bbox_angle(&[source]) - f64::from(angle)).abs() < 1e-6); + select(&mut s, &[target, source]); + s.execute("select.key", &json!({"id": source.0})).unwrap(); + let before = s.doc().unwrap().doc.clone(); + let n = steps(&s); + let result = s.execute("addon.arrange.match", &json!({"rotate": true})); + if angle == 0 { + assert_eq!(result.unwrap(), json!({"source": source.0, "count": 1})); + } else { + let error = result.unwrap_err().to_string(); + assert!(error.contains(&format!("object {} has no bounds to rotate", target.0)), "{error}"); + } + assert_eq!(steps(&s), n); + assert!(*s.doc().unwrap().doc == *before); + } +} + #[test] fn match_puts_the_others_directly_above_the_source() { let mut s = session(); @@ -514,10 +573,122 @@ fn replays_the_stroke_scaling_it_ran_with(cmd: &str, p: Value) { s.execute("edit.undo", &json!({})).unwrap(); s.execute("prefs.set", &json!({"key": "scaleStrokes", "value": false})).unwrap(); select(&mut s, &[a, b]); - s.execute(&id, &q).unwrap(); + s.replay(&id, &q).unwrap(); assert!((weight(&s) - 4.0).abs() < 1e-9, "{cmd} replayed: {}", weight(&s)); } +#[test] +fn match_stacking_leaves_a_clipping_path_in_place() { + let mut s = session(); + let art = rect(&mut s, 0.0, 0.0, 40.0, 40.0); + let mask = rect(&mut s, 10.0, 10.0, 10.0, 10.0); + select(&mut s, &[art, mask]); + s.execute("object.clippingMask.make", &json!({})).unwrap(); + let x = rect(&mut s, 200.0, 0.0, 10.0, 10.0); + select(&mut s, &[mask, x]); + s.execute("select.key", &json!({"id": x.0})).unwrap(); + refuses(&mut s, "addon.arrange.match", &[json!({"stacking": true})]); +} + +#[test] +fn match_size_refuses_a_target_with_no_width() { + let mut s = session(); + let line = NodeId(s.execute("shape.line", &json!({"x1": 0, "y1": 0, "x2": 0, "y2": 50})).unwrap()["id"].as_u64().unwrap()); + let b = rect(&mut s, 100.0, 0.0, 20.0, 20.0); + select(&mut s, &[line, b]); + s.execute("select.key", &json!({"id": b.0})).unwrap(); + refuses(&mut s, "addon.arrange.match", &[json!({"size": "width"}), json!({"size": "both"})]); + // Its height can still take the source's. + s.execute("addon.arrange.match", &json!({"size": "height"})).unwrap(); + assert!((bounds(&s, line).height() - 20.0).abs() < 1e-6, "{:?}", bounds(&s, line)); +} + +#[test] +fn match_size_uses_preview_bounds_for_a_target_with_no_geometric_width() { + let mut s = session(); + s.execute("prefs.set", &json!({"key": "usePreviewBounds", "value": true})).unwrap(); + let line = NodeId(s.execute("shape.line", &json!({"x1": 0, "y1": 0, "x2": 0, "y2": 50})).unwrap()["id"].as_u64().unwrap()); + select(&mut s, &[line]); + s.execute("paint.setStroke", &json!({"color": "#000000"})).unwrap(); + s.execute("stroke.set", &json!({"weight": 2, "cap": "butt"})).unwrap(); + let b = rect(&mut s, 100.0, 0.0, 2.0, 100.0); + select(&mut s, &[b]); + s.execute("paint.setStroke", &json!({"none": true})).unwrap(); + select(&mut s, &[line, b]); + s.execute("select.key", &json!({"id": b.0})).unwrap(); + s.execute("addon.arrange.match", &json!({"size": "both", "scaleStrokes": false})).unwrap(); + let measured = s.transform_box(&[line]).unwrap().rect; + let wanted = s.transform_box(&[b]).unwrap().rect; + assert!((measured.width() - wanted.width()).abs() < 1e-6, "{measured:?}"); + assert!((measured.height() - wanted.height()).abs() < 1e-6, "{measured:?}"); + select(&mut s, &[b]); + s.execute("object.setBounds", &json!({"width": 4})).unwrap(); + select(&mut s, &[line, b]); + s.execute("select.key", &json!({"id": b.0})).unwrap(); + refuses(&mut s, "addon.arrange.match", &[json!({"size": "both", "scaleStrokes": false})]); +} + +#[test] +fn match_stacking_takes_a_member_out_of_its_intertwine_group() { + let mut s = session(); + let a = rect(&mut s, 0.0, 0.0, 40.0, 40.0); + let b = rect(&mut s, 20.0, 20.0, 40.0, 40.0); + select(&mut s, &[a, b]); + let g = NodeId(s.execute("object.intertwine.make", &json!({})).unwrap()["id"].as_u64().unwrap()); + s.execute("object.intertwine.arrange", &json!({"at": [30, 30], "order": "front", "member": a.0})).unwrap(); + assert!(s.doc().unwrap().doc.node(a).unwrap().extras().intertwine.is_some(), "a is drawn over b in their overlap"); + let c = rect(&mut s, 200.0, 0.0, 10.0, 10.0); + select(&mut s, &[a, c]); + s.execute("select.key", &json!({"id": c.0})).unwrap(); + s.execute("addon.arrange.match", &json!({"stacking": true})).unwrap(); + let d = &s.doc().unwrap().doc; + assert_ne!(d.parent_of(a), Some(g), "a left the Intertwine group"); + let e = d.node(a).unwrap().extras(); + assert!(e.intertwine.is_none() && e.intertwine_tiers.is_empty(), "a keeps no Intertwine areas"); + s.execute("edit.undo", &json!({})).unwrap(); + assert_eq!(s.doc().unwrap().doc.parent_of(a), Some(g), "undo puts a back in its group"); +} + +#[test] +fn match_stacking_needs_no_bounds_on_the_source() { + let mut s = session(); + let b = rect(&mut s, 100.0, 0.0, 20.0, 20.0); + let a = rect(&mut s, 0.0, 0.0, 10.0, 10.0); + let g = NodeId(s.execute("object.group", &json!({})).unwrap()["id"].as_u64().unwrap()); + s.execute("select.set", &json!({"ids": [a.0]})).unwrap(); + s.execute("edit.clear", &json!({})).unwrap(); + select(&mut s, &[b, g]); + s.execute("select.key", &json!({"id": g.0})).unwrap(); + s.execute("addon.arrange.match", &json!({"stacking": true})).unwrap(); + assert_eq!(layer_order(&s), [g, b], "b goes directly above the empty group"); +} + +#[test] +fn match_stacking_refuses_intertwine_nesting_beside_an_empty_group() { + let mut s = session(); + let a = rect(&mut s, 0.0, 0.0, 40.0, 40.0); + let source = NodeId(s.execute("object.group", &json!({})).unwrap()["id"].as_u64().unwrap()); + let b = rect(&mut s, 20.0, 20.0, 40.0, 40.0); + select(&mut s, &[source, b]); + let parent = NodeId(s.execute("object.intertwine.make", &json!({})).unwrap()["id"].as_u64().unwrap()); + select(&mut s, &[a]); + s.execute("edit.clear", &json!({})).unwrap(); + assert!(s.transform_box(&[source]).is_none()); + assert_eq!(s.doc().unwrap().doc.parent_of(source), Some(parent)); + let c = rect(&mut s, 100.0, 0.0, 40.0, 40.0); + let d = rect(&mut s, 120.0, 20.0, 40.0, 40.0); + select(&mut s, &[c, d]); + let target = NodeId(s.execute("object.intertwine.make", &json!({})).unwrap()["id"].as_u64().unwrap()); + select(&mut s, &[source, target]); + s.execute("select.key", &json!({"id": source.0})).unwrap(); + let before = s.doc().unwrap().doc.clone(); + let n = steps(&s); + let error = s.execute("addon.arrange.match", &json!({"stacking": true})).unwrap_err().to_string(); + assert!(error.contains("can't be intertwined"), "{error}"); + assert_eq!(steps(&s), n); + assert!(*s.doc().unwrap().doc == *before); +} + #[test] fn match_replays_with_the_stroke_scaling_it_ran_with() { replays_the_stroke_scaling_it_ran_with("addon.arrange.match", json!({"size": "both"})); diff --git a/crates/ui-egui/src/addons/arrange.rs b/crates/ui-egui/src/addons/arrange.rs index 3c8483000d..a05d713244 100644 --- a/crates/ui-egui/src/addons/arrange.rs +++ b/crates/ui-egui/src/addons/arrange.rs @@ -30,7 +30,7 @@ const MATCH: &str = "addon.arrange.match"; const OPACITY: &str = "addon.arrange.randomizeOpacity"; const SORT: &str = "addon.arrange.sort"; /// Each dialog's command and heading. -const DIALOGS: [(&str, &str); 6] = [ +const DIALOGS: [(&str, &str); 7] = [ (GRID, "Arrange in Grid"), (OFFSET, "Offset Objects"), (REPLACE, "Replace with Top Object"), diff --git a/docs/mcp.md b/docs/mcp.md index 42bd2ef607..a9e9d9649a 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -17581,7 +17581,7 @@ as `object.setBounds` measures them (Use Preview Bounds), except Arrange in Grid | `addon.arrange.swap` | `size` (false); `scaleStrokes` (the Scale Strokes & Effects preference) | Swaps the bounds centres of exactly two selected objects (off otherwise); with `size`, each also takes the other's width and height. | | `addon.arrange.replace` | `fit`: `keep`, `bounds` (the replaced object's width and height), `proportional` (fits inside them) (`keep`); `scaleStrokes`; `keep` (false) | Puts a copy of the topmost selected object centred on each of the other selected objects, in that object's place in the stacking order; the replaced objects are deleted unless `keep` (the copy then goes right above each). Needs two objects or more; the copies are selected. → `{ids}` | | `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 does not have, are refused. To match places, use `object.align {to: "key"}`. → `{source, count}` | +| `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.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}` | diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index bde309e3c9..395fdda4de 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -3148,7 +3148,7 @@ dialogs, Preview and Cancel, Zoom to Selection) and `command_sweep`. Commands: ` ## Arrange Tools add-on: Match Objects (2026-11-29) -A VectorCraft addition, not a feature of the reference app, so no area score moves. Object › Plug-ins › Arrange Tools › Match Objects… makes the other top-level selected objects (at most 20000) match one of them, the source: the key object, or the top or the bottom selected object. Each can take the source's width (the height following in proportion), its height (the width following), or both, measured as `object.setBounds` measures them (Use Preview Bounds) in each object's own bounding-box frame; its bounding-box angle; and its stacking place, directly above the source in its layer or group, in the order they had. Sizing and turning keep each object's reference point in place, and strokes, effects and pattern tiles follow Scale Strokes & Effects and Transform Pattern Tiles. The source stays as it is, the dialog previews on the canvas, and OK is one undo step; no step when nothing changes. Places are matched with Align to Key Object (`object.align {to: "key"}`). Tests: `match_*` in `cmd::addons::arrange::tests` in `vectorcraft-engine` (each size, the key, top and bottom sources, angles about the center, stacking within and across layers, no step when matched, bad params), `real_match_keyboard_edits_preview_confirm_and_cancel` in `vectorcraft-ui-egui` and `command_sweep`. Commands: `docs/mcp.md` › Arrange Tools add-on. +A VectorCraft addition, not a feature of the reference app, so no area score moves. Object › Plug-ins › Arrange Tools › Match Objects… makes the other top-level selected objects (at most 20000) match one of them, the source: the key object, or the top or the bottom selected object. Each can take the source's width (the height following in proportion), its height (the width following), or both, measured as `object.setBounds` measures them (Use Preview Bounds) in each object's own bounding-box frame; its bounding-box angle; and its stacking place, directly above the source in its layer or group, in the order they had (a clipping path keeps its place, so such a match is refused). Sizing and turning keep each object's reference point in place, and strokes, effects and pattern tiles follow Scale Strokes & Effects and Transform Pattern Tiles. The source stays as it is, the dialog previews on the canvas, and OK is one undo step; no step when nothing changes. Places are matched with Align to Key Object (`object.align {to: "key"}`). Tests: `match_*` in `cmd::addons::arrange::tests` in `vectorcraft-engine` (each size, the key, top and bottom sources, angles about the center, stacking within and across layers, no step when matched, bad params), `real_match_keyboard_edits_preview_confirm_and_cancel` in `vectorcraft-ui-egui` and `command_sweep`. Commands: `docs/mcp.md` › Arrange Tools add-on. ## Arrange Tools add-on: Group Overlapping Objects (2026-11-01)