Skip to content

VectorCraft: An open-source, vector art tool written by scratch in pure Rust

Fix #5054: a double-click on a repeat isolates it to edit its source

Don Omondi046e4439440f
diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rs
index 26cf67627..4345f640c 100644
--- a/crates/engine/src/tests.rs
+++ b/crates/engine/src/tests.rs
@@ -135,6 +135,7 @@ mod recolor;
mod recovery;
mod reflecthit;
mod registration;
+mod repeat_edit;
mod save;
mod saveoptions;
mod scalestrokes;
diff --git a/crates/engine/src/tests/repeat_edit.rs b/crates/engine/src/tests/repeat_edit.rs
new file mode 100644
index 000000000..ca57a569f
--- /dev/null
+++ b/crates/engine/src/tests/repeat_edit.rs
@@ -0,0 +1,40 @@
+//! Editing a repeat's source art (#5054): a double-click on a repeat with the Selection tool
+//! enters isolation mode on it; there a double-click on its type edits the text, and the repeat
+//! keeps its settings and draws the new text in every copy.
+
+use serde_json::json;
+use vectorcraft_doc::{NodeId, NodeKind};
+use vectorcraft_tools::{PointerEvent, PointerKind};
+
+use crate::*;
+
+fn click(s: &mut Session, kind: PointerKind, x: f64, y: f64) -> Vec<UiRequest> {
+ s.pointer(&PointerEvent::new(kind, x, y), ViewInfo { smart_guides: false, ..ViewInfo::default() }).unwrap()
+}
+
+#[test]
+fn a_double_click_on_a_repeat_isolates_it_to_edit_its_text() {
+ let mut s = Session::new();
+ s.execute("file.new", &json!({"width": 600, "height": 400})).unwrap();
+ let text = NodeId(s.execute("text.create", &json!({"x": 50, "y": 60, "text": "Alice", "size": 24})).unwrap()["id"].as_u64().unwrap());
+ s.execute("select.set", &json!({"ids": [text.0]})).unwrap();
+ let repeat = NodeId(s.execute("object.repeat.grid", &json!({})).unwrap()["id"].as_u64().unwrap());
+ let spec = |s: &Session| match &s.doc().unwrap().doc.node(repeat).unwrap().kind {
+ NodeKind::Repeat(r) => serde_json::to_value(r).unwrap(),
+ k => panic!("not a repeat: {k:?}"),
+ };
+ let before = spec(&s);
+ s.select_tool("selection", ViewInfo::default()).unwrap();
+ let b = s.doc().unwrap().doc.node(text).unwrap().geometric_bounds().unwrap();
+ let (x, y) = (b.center().x, b.center().y);
+ click(&mut s, PointerKind::DoubleClick, x, y);
+ assert_eq!(s.doc().unwrap().isolation, Some(repeat), "the double-click isolates the repeat");
+ // Inside it, a double-click on the type asks for the Type tool, which edits that text.
+ let asked = click(&mut s, PointerKind::DoubleClick, x, y);
+ assert!(asked.iter().any(|r| matches!(r, UiRequest::SwitchTool(t) if t == "type")), "{asked:?}");
+ s.execute("text.setText", &json!({"id": text.0, "text": "Bob"})).unwrap();
+ let NodeKind::Text(t) = &s.doc().unwrap().doc.node(text).unwrap().kind else { panic!("not type") };
+ assert_eq!(t.plain_text(), "Bob");
+ assert_eq!(s.doc().unwrap().doc.position(text).and_then(|(p, ..)| p), Some(repeat), "still the repeat's source");
+ assert_eq!(spec(&s)["rows"], before["rows"], "the repeat keeps its settings");
+}
diff --git a/crates/tools/src/select.rs b/crates/tools/src/select.rs
index 46f2401f2..17d5fef17 100644
--- a/crates/tools/src/select.rs
+++ b/crates/tools/src/select.rs
@@ -1035,7 +1035,8 @@ pub(crate) fn is_threadable(n: &vectorcraft_doc::Node) -> bool {
/// Does a double-click or the Control bar's Isolate Selected Object button isolate an object of
/// this kind? A group, a compound path or a single path, image, mesh or placed file does. Blends,
-/// envelopes, repeats and symbol instances do not; they have editing modes of their own.
+/// envelopes, repeats and symbol instances do not; they have editing modes of their own (a
+/// double-click on a repeat isolates it to edit its source art).
pub fn isolates(kind: &vectorcraft_doc::NodeKind) -> bool {
use vectorcraft_doc::NodeKind as K;
matches!(kind, K::Group { .. } | K::Compound { .. } | K::Path { .. } | K::Image(_) | K::Mesh(_) | K::PlacedDocument(_))
@@ -1198,6 +1199,11 @@ impl SelectionTool {
if cx.doc.node(top).is_some_and(|n| matches!(n.kind, vectorcraft_doc::NodeKind::SymbolInstance { .. })) {
return if cx.doc.symbol_edit.is_some() { vec![] } else { vec![Action::Exec("symbol.edit".into(), json!({ "id": top.0 }))] };
}
+ // A repeat: its source art is edited in isolation mode, where the repeat follows each
+ // edit (#5054), as the reference app's Repeat does.
+ if cx.doc.node(top).is_some_and(|n| matches!(n.kind, vectorcraft_doc::NodeKind::Repeat(_))) && cx.isolation != Some(top) {
+ return vec![Action::Exec("object.isolate".into(), json!({ "id": top.0 }))];
+ }
// An object that [`isolates`], not the one already isolated.
if cx.double_click_isolate && cx.doc.node(top).is_some_and(|n| isolates(&n.kind)) && cx.isolation != Some(top) {
return vec![Action::Exec("object.isolate".into(), json!({ "id": top.0 }))];
diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md
index dd083fdb1..d69100339 100644
--- a/docs/target-app-parity.md
+++ b/docs/target-app-parity.md
@@ -1513,10 +1513,15 @@ Edit › Keyboard Shortcuts lists every item of the Effect menu under its menu p
While a corner widget is pressed or dragged with the Selection or Direct Selection tool, the Up and Down arrows step the kind of the corners being edited (Round, Inverted Round, Chamfer, in turn, from the pressed corner's), shown live with the radius and kept, with it, as one undo step when the drag ends; a press with an arrow and no drag changes just the kind (#2898). Alt-clicking a widget still cycles it as before. Test: `tests::livecorners::arrows_while_dragging_a_corner_widget_change_the_corner_kind`.
+## Repeat: edit the source art in isolation mode (2026-11-01)
+
+A double-click on a Repeat (Radial, Grid or Mirror) with the Selection tool enters isolation mode on it ([isolate objects](https://helpx.adobe.com/illustrator/desktop/manage-objects/select-objects/isolate-objects.html): a double-click with the Selection tool isolates an object; [repeat patterns overview](https://helpx.adobe.com/illustrator/desktop/paint-and-fill/create-and-edit-patterns/repeat-patterns-overview.html): every instance follows edits to the original object); there the source art is selected and edited as usual (a double-click on type in it switches to the Type tool on that text) and every copy follows, with the repeat's settings kept (#5054). Test: `tests::repeat_edit::a_double_click_on_a_repeat_isolates_it_to_edit_its_text`.
+
## Revision history
| Date | Change | Summary |
|---|---|---|
+| 2026-11-01 | minor | Repeat: a double-click isolates it to edit its source art, text included (#5054); evidence added; scores unchanged. |
| 2026-11-01 | minor | Live Corners: Up/Down while dragging a corner widget step the corner kind (#2898); evidence added; scores unchanged. |
| 2026-11-01 | minor | Shortcuts for Effect menu items (#3296); evidence added; scores unchanged. |
| 2026-11-01 | minor | Color Effects add-on (a VectorCraft addition): Find Nearest Swatch (#4923); evidence added; scores unchanged. |
diff --git a/docs/ui-parity.md b/docs/ui-parity.md
index 88e87ddc3..e915b8a65 100644
--- a/docs/ui-parity.md
+++ b/docs/ui-parity.md
@@ -400,6 +400,7 @@ separate. Scores and hours unchanged. [Behavior and command details](development
| Date | Change | Summary |
|---|---|---|
+| 2026-11-01 | minor | A double-click on a Repeat with the Selection tool enters isolation mode on it, where its source art (type included: a double-click there edits the text) is edited and every copy follows (#5054); scores and estimates unchanged |
| 2026-11-01 | minor | Live Corners: while a corner widget is pressed or dragged with the Selection or Direct Selection tool, the Up and Down arrows step the corners' kind (round, inverted round, chamfer) with the radius, as one undo step (#2898); scores and estimates unchanged |
| 2026-11-01 | minor | Keyboard Shortcuts: every Effect menu item (Distort & Transform › Transform…, Stylize › Drop Shadow…, …) is listed under its menu path and takes a shortcut of its own, which the menu shows and which opens that effect's dialog (or applies an effect without options) (#3296); scores and estimates unchanged |
| 2026-10-31 | minor | Units › East Asian Type acts (#394): Q and Ha (a quarter of a millimetre each) are units that preference offers; 4 Preferences options remain stored but unused; scores and estimates unchanged |