From d92a1f9134cd3cbb18242e716d8813000f32dd3b Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Wed, 18 Nov 2026 08:05:48 -0800 Subject: [PATCH] Actions: an action can choose Align To when it plays object.align takes to: "auto", which aligns to the key object, key anchor or key guide when the selection has one, else to the artboard when exactly one object is selected and no anchor points are, else to the selection. New Action and Action Options have Choose Align To at playback (automaticAlignTo on ui.action.new and ui.action.options), off by default. With it on, playback sends to: "auto" for each object.align step, without any artboard index the step stores, so the step uses the active artboard; the stored steps keep their recorded params. Save Actions writes the option, and a set that uses it is saved as file version 7. The dialog's strings have rows in every catalog, and docs/mcp.md describes to: "auto", automaticAlignTo and file version 7. Fixes #6972. Supersedes #7635. Co-authored-by: yoriswind --- crates/engine/src/cmd/object/align.rs | 22 +- crates/engine/src/cmd/object/commands.rs | 2 +- crates/engine/src/tests.rs | 5 +- .../tests/it/align_automatic_reference.rs | 69 +++ crates/engine/tests/it/main.rs | 1 + crates/mcp/src/ui_catalog.rs | 4 +- crates/ui-egui/src/dialogs/action_new.rs | 17 +- .../ui-egui/src/dialogs/action_set_options.rs | 9 +- crates/ui-egui/src/i18n/bg.tsv | 4 + crates/ui-egui/src/i18n/bs.tsv | 4 + crates/ui-egui/src/i18n/ca.tsv | 4 + crates/ui-egui/src/i18n/cs.tsv | 4 + crates/ui-egui/src/i18n/da.tsv | 4 + crates/ui-egui/src/i18n/de.tsv | 4 + crates/ui-egui/src/i18n/el.tsv | 4 + crates/ui-egui/src/i18n/es.tsv | 4 + crates/ui-egui/src/i18n/fi.tsv | 4 + crates/ui-egui/src/i18n/fr.tsv | 4 + crates/ui-egui/src/i18n/gu.tsv | 4 + crates/ui-egui/src/i18n/hi.tsv | 4 + crates/ui-egui/src/i18n/hu.tsv | 4 + crates/ui-egui/src/i18n/id.tsv | 4 + crates/ui-egui/src/i18n/it.tsv | 4 + crates/ui-egui/src/i18n/ja.tsv | 4 + crates/ui-egui/src/i18n/ka.tsv | 4 + crates/ui-egui/src/i18n/ko.tsv | 4 + crates/ui-egui/src/i18n/nl.tsv | 4 + crates/ui-egui/src/i18n/pl.tsv | 4 + crates/ui-egui/src/i18n/pt-br.tsv | 4 + crates/ui-egui/src/i18n/ru.tsv | 4 + crates/ui-egui/src/i18n/sv.tsv | 4 + crates/ui-egui/src/i18n/tr.tsv | 4 + crates/ui-egui/src/i18n/uk.tsv | 4 + crates/ui-egui/src/i18n/vi.tsv | 4 + crates/ui-egui/src/i18n/zh-hans.tsv | 4 + crates/ui-egui/src/i18n/zh-hant.tsv | 4 + crates/ui-egui/src/menus/ui_commands.rs | 4 +- crates/ui-egui/src/panels/actions.rs | 90 +++- crates/ui-egui/src/panels/actions/files.rs | 40 +- .../ui-egui/tests/actions_automatic_align.rs | 392 ++++++++++++++++++ docs/mcp.md | 41 +- docs/target-app-parity.md | 3 +- 42 files changed, 767 insertions(+), 44 deletions(-) create mode 100644 crates/engine/tests/it/align_automatic_reference.rs create mode 100644 crates/ui-egui/tests/actions_automatic_align.rs diff --git a/crates/engine/src/cmd/object/align.rs b/crates/engine/src/cmd/object/align.rs index d55fdda7b2..2b6e1b7e10 100644 --- a/crates/engine/src/cmd/object/align.rs +++ b/crates/engine/src/cmd/object/align.rs @@ -218,12 +218,32 @@ pub(super) fn align(s: &mut Session, p: &Value) -> Result { let ids = selected_roots(s)?; let m = measure(s, p, "object.align")?; let (h, v) = direction(p, "object.align")?; - choice(p, "object.align", "to", &["selection", "artboard", "key"])?; + let to = choice(p, "object.align", "to", &["selection", "artboard", "key", "auto"])?; check_switches(p, &["patterns"], "object.align")?; check_numbers(p, &["artboard"], "object.align")?; if h.is_none() && v.is_none() { return Err(bad("object.align", "give horizontal or vertical")); } + // Resolve only the explicit automatic target at this step, without changing the caller's + // parameters or selection. The existing reference/anchor/guide paths receive a concrete target. + let automatic_params = if to == Some("auto") { + let selection = &s.doc()?.selection; + let to = if selection.has_key() { + "key" + } else if selection.anchors.is_empty() && selection.len() == 1 { + "artboard" + } else { + "selection" + }; + let Some(mut params) = p.as_object().cloned() else { + return Err(bad("object.align", "expected an object of align parameters")); + }; + params.insert("to".into(), Value::String(to.into())); + Some(Value::Object(params)) + } else { + None + }; + let p = automatic_params.as_ref().unwrap_or(p); // Anchor points selected with Direct Selection align themselves, as in Illustrator (#1180). if !s.doc()?.selection.anchors.is_empty() { return align_anchors(s, p, &ids, (h, v)); diff --git a/crates/engine/src/cmd/object/commands.rs b/crates/engine/src/cmd/object/commands.rs index 92f4744fea..565d22eede 100644 --- a/crates/engine/src/cmd/object/commands.rs +++ b/crates/engine/src/cmd/object/commands.rs @@ -268,7 +268,7 @@ pub fn specs() -> Vec { "Align", ["Window", "Align"], None, - "{horizontal?: \"left\"|\"center\"|\"right\", vertical?: \"top\"|\"center\"|\"bottom\", to?: \"selection\"|\"artboard\"|\"key\" (default: the key object when the selection has one, select.key, else the selection; a key guide, select.key {guide}, stays put and the objects line up on its line: a vertical guide sets where left, center and right go and vertical alignment leaves them, a horizontal one the other way round; aligning to the key, the other selected ruler guides move too: a vertical guide to the key's left edge, center or right edge, a horizontal one to its top, center or bottom; aligning to the artboard moves selected guides to its edges too (#3463), and with only guides selected aligning to the selection moves them to their collective bounds), artboard?: index (0-based; with to: \"artboard\", the artboard to align to; the app passes the active one; default: the artboard under the center of the selection, else the first), bounds?: \"preview\"|\"geometric\" (default: the Use Preview Bounds preference; preview bounds take in strokes, geometry effects and projected 3D art), patterns?: bool (Transform Patterns: pattern fills and strokes transform with the art; default: prefs transformPatternTiles)} With anchor points selected (Direct Selection), the points align instead: to their own bounds, to the artboard (#1180), or, aligning to the key with a key anchor (select.key {id, anchor}), to the key anchor, which stays put", + "{horizontal?: \"left\"|\"center\"|\"right\", vertical?: \"top\"|\"center\"|\"bottom\", to?: \"selection\"|\"artboard\"|\"key\"|\"auto\" (\"auto\": resolve at each call from the current selection: the key object, key anchor or key guide while set, else the artboard for exactly one selected object without selected anchors, else the selection; default: the key object when the selection has one, select.key, else the selection; a key guide, select.key {guide}, stays put and the objects line up on its line: a vertical guide sets where left, center and right go and vertical alignment leaves them, a horizontal one the other way round; aligning to the key, the other selected ruler guides move too: a vertical guide to the key's left edge, center or right edge, a horizontal one to its top, center or bottom; aligning to the artboard moves selected guides to its edges too (#3463), and with only guides selected aligning to the selection moves them to their collective bounds), artboard?: index (0-based; with to: \"artboard\", or \"auto\" choosing the artboard, the artboard to align to; the app passes the active one; default: the artboard under the center of the selection, else the first), bounds?: \"preview\"|\"geometric\" (default: the Use Preview Bounds preference; preview bounds take in strokes, geometry effects and projected 3D art), patterns?: bool (Transform Patterns: pattern fills and strokes transform with the art; default: prefs transformPatternTiles)} With anchor points selected (Direct Selection), the points align instead: to their own bounds, to the artboard (#1180), or, aligning to the key with a key anchor (select.key {id, anchor}), to the key anchor, which stays put", has_selection_or_guides, align ), diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rs index 38692e9056..394acf29d0 100644 --- a/crates/engine/src/tests.rs +++ b/crates/engine/src/tests.rs @@ -859,12 +859,13 @@ fn align_and_distribute_reject_bad_params_without_changing_state() { let h = "`horizontal` must be one of left, center, right"; let v = "`vertical` must be one of top, center, bottom"; let to = "`to` must be one of selection, artboard, key"; + let align_to = "`to` must be one of selection, artboard, key, auto"; for (cmd, p, msg) in [ ("object.align", json!({"horizontal": "middle"}), h), ("object.align", json!({"vertical": "centre"}), v), ("object.align", json!({"horizontal": true}), h), - ("object.align", json!({"horizontal": "left", "to": "page"}), to), - ("object.align", json!({"horizontal": "left", "to": 0}), to), + ("object.align", json!({"horizontal": "left", "to": "page"}), align_to), + ("object.align", json!({"horizontal": "left", "to": 0}), align_to), ("object.align", json!({"horizontal": "left", "bounds": false}), "`bounds` must be one of preview, geometric"), ("object.align", json!({"horizontal": "left", "vertical": "middle"}), v), ("object.distribute", json!({"horizontal": "middle"}), h), diff --git a/crates/engine/tests/it/align_automatic_reference.rs b/crates/engine/tests/it/align_automatic_reference.rs new file mode 100644 index 0000000000..2bdc5df5fc --- /dev/null +++ b/crates/engine/tests/it/align_automatic_reference.rs @@ -0,0 +1,69 @@ +//! Engine-only controls for explicit automatic Align references. + +use serde_json::{Value, json}; +use vectorcraft_doc::NodeId; +use vectorcraft_engine::Session; +use vectorcraft_geom::Point; + +fn session() -> Session { + let mut s = Session::new(); + s.execute("file.new", &json!({"width": 400, "height": 300, "profile": null})).unwrap(); + s +} + +fn align_with(s: &mut Session, mut params: Value, automatic: bool) { + if automatic { + params["to"] = json!("auto"); + } + s.execute("object.align", ¶ms).unwrap(); +} + +#[test] +fn automatic_align_keeps_one_objects_key_guide_reference() { + for automatic in [false, true] { + let mut s = session(); + let id = NodeId(s.execute("shape.rectangle", &json!({"x": 20, "y": 40, "width": 40, "height": 20})).unwrap()["id"].as_u64().unwrap()); + s.execute("guide.add", &json!({"vertical": false, "pos": 210})).unwrap(); + s.execute("select.set", &json!({"ids": [id.0]})).unwrap(); + s.execute("guide.select", &json!({"indexes": [0], "toggle": true})).unwrap(); + s.execute("select.key", &json!({"guide": 0})).unwrap(); + let selection = s.doc().unwrap().selection.clone(); + assert_eq!(selection.len(), 1); + assert!(selection.has_key()); + let guide = selection.key_guide.unwrap(); + + align_with(&mut s, json!({"horizontal": "right", "vertical": "bottom", "bounds": "geometric"}), automatic); + let bounds = s.doc().unwrap().doc.bounds_of(&[id], false).unwrap(); + assert_eq!( + (bounds.x0, bounds.y0, bounds.x1, bounds.y1), + (20.0, 190.0, 60.0, 210.0), + "the horizontal key guide overrides the one-object artboard rule and leaves x alone" + ); + assert_eq!(s.doc().unwrap().doc.ruler_guide(guide).unwrap().pos, 210.0); + assert_eq!(s.doc().unwrap().selection, selection, "reference resolution does not create or clear a key"); + } +} + +#[test] +fn automatic_align_keeps_a_single_paths_selected_anchor_bounds() { + for automatic in [false, true] { + let mut s = session(); + let id = NodeId(s.execute("path.create", &json!({"d": "M20 40 L60 100 L100 40", "closed": false})).unwrap()["id"].as_u64().unwrap()); + s.execute("select.anchors", &json!({"id": id.0, "anchors": [[0, 0], [0, 1]], "mode": "set"})).unwrap(); + let selection = s.doc().unwrap().selection.clone(); + assert_eq!(selection.len(), 1); + assert!(!selection.anchors.is_empty()); + assert!(!selection.has_key()); + + align_with(&mut s, json!({"horizontal": "center", "bounds": "geometric"}), automatic); + let document = &s.doc().unwrap().doc; + let path = document.node(id).unwrap().path_data().unwrap(); + let points: Vec = path.subpaths.first().unwrap().anchors.iter().map(|anchor| anchor.p).collect(); + assert_eq!( + points, + [Point::new(40.0, 40.0), Point::new(40.0, 100.0), Point::new(100.0, 40.0)], + "only picked anchors use their own center; the whole path is not centered on the artboard" + ); + assert_eq!(s.doc().unwrap().selection, selection); + } +} diff --git a/crates/engine/tests/it/main.rs b/crates/engine/tests/it/main.rs index 9227ee199d..5255736ad8 100644 --- a/crates/engine/tests/it/main.rs +++ b/crates/engine/tests/it/main.rs @@ -9,6 +9,7 @@ mod text_fixture; mod affinity_features; mod affinity_local; +mod align_automatic_reference; mod artboard_click; mod beyond_canvas; mod clear_commands; diff --git a/crates/mcp/src/ui_catalog.rs b/crates/mcp/src/ui_catalog.rs index 88f60fd6c8..085ad9b0d0 100644 --- a/crates/mcp/src/ui_catalog.rs +++ b/crates/mcp/src/ui_catalog.rs @@ -1660,13 +1660,13 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[ "ui.action.new", "New Action", "", - "{set: index, name, key?: 0-15, cmd?, shift?, color?: red|yellow|green|blue|violet} add an action named name (spaces trimmed from both ends) after the last action of the Actions panel's set at set (0 is the top set) and start recording into it; Stop Playing/Recording (ui.action.stop) ends the recording. key 1 to 15 is the function key F1 to F15 that plays the action (0 or null: none), with cmd (Ctrl, Command on macOS) and shift; color is its Button Mode color (null or \"\": none), the color of its button in Button Mode (ui.action.buttonMode). Action function keys take priority over command shortcuts and preserve the command's binding. On Windows F1, Ctrl+F4 and Ctrl+F6 cannot be used. The set becomes current and the new action is selected. The panel's Create New Action button and menu's New Action… (dialog `actionNew` with set, name, key, cmd, shift and color) run this on Record. While an action is recording, and for an index past the last set, an empty name, a key or color that is not one of these, or an action that would give the set more than 1,000 actions or an action set file larger than 8 MiB, it is an error, nothing is added and no recording starts → {set, action}", + "{set: index, name, key?: 0-15, cmd?, shift?, color?: red|yellow|green|blue|violet, automaticAlignTo?: bool} add an action named name (spaces trimmed from both ends) after the last action of the Actions panel's set at set (0 is the top set) and start recording into it; Stop Playing/Recording (ui.action.stop) ends the recording. key 1 to 15 is the function key F1 to F15 that plays the action (0 or null: none), with cmd (Ctrl, Command on macOS) and shift; color is its Button Mode color (null or \"\": none), the color of its button in Button Mode (ui.action.buttonMode). Action function keys take priority over command shortcuts and preserve the command's binding. On Windows F1, Ctrl+F4 and Ctrl+F6 cannot be used. automaticAlignTo (false when omitted or null) makes each object.align choose its reference at playback: an active key object, key anchor or key guide, else the artboard for one whole selected object, else the selection; false uses the recorded target, and stored steps stay unchanged. The set becomes current and the new action is selected. The panel's Create New Action button and menu's New Action… (dialog `actionNew` with set, name, key, cmd, shift, color and automaticAlignTo) run this on Record. While an action is recording, and for an index past the last set, an empty name, a key or color that is not one of these, or an action that would give the set more than 1,000 actions or an action set file larger than 8 MiB, it is an error, nothing is added and no recording starts → {set, action}", ), ( "ui.action.options", "Action Options", "", - "{set: index, action: index, name?, key?: 0-15, cmd?, shift?, color?: red|yellow|green|blue|violet} change the Actions panel's action at action in set (0 is the top set); its steps stay. name renames it (spaces trimmed from both ends), key 1 to 15 with cmd (Ctrl, Command on macOS) and shift sets the function key F1 to F15 that plays it (0 or null: none), and color sets its Button Mode color (null or \"\": none); a param left out keeps what the action has, and cmd or shift alone changes that modifier of its key. Action function keys take priority over command shortcuts and preserve the command's binding. The panel menu's Action Options… (dialog `actionSetOptions` with set, action, name, key, cmd, shift and color) runs this for the selected action. An index past the last set or action, an empty name, a key or color that is not one of these, or a change that would give the set's action set file more than 8 MiB (counting the steps the recording in progress adds to it; a change that leaves the file as large or makes it smaller is never refused) is an error and changes nothing → {name, key, color}", + "{set: index, action: index, name?, key?: 0-15, cmd?, shift?, color?: red|yellow|green|blue|violet, automaticAlignTo?: bool} change the Actions panel's action at action in set (0 is the top set); its steps stay. name renames it (spaces trimmed from both ends), key 1 to 15 with cmd (Ctrl, Command on macOS) and shift sets the function key F1 to F15 that plays it (0 or null: none), and color sets its Button Mode color (null or \"\": none); a param left out keeps what the action has, and cmd or shift alone changes that modifier of its key. automaticAlignTo overrides each object.align reference at playback with the current key object, key anchor or key guide, else the artboard for one whole selected object, else the selection; false uses the unchanged recorded targets, and omission or null keeps the option. Action function keys take priority over command shortcuts and preserve the command's binding. The panel menu's Action Options… (dialog `actionSetOptions` with set, action, name, key, cmd, shift, color and automaticAlignTo) runs this for the selected action. An index past the last set or action, an empty name, a key or color that is not one of these, or a change that would give the set's action set file more than 8 MiB (counting the steps the recording in progress adds to it; a change that leaves the file as large or makes it smaller is never refused) is an error and changes nothing → {name, key, color, automaticAlignTo}", ), ( "ui.action.play", diff --git a/crates/ui-egui/src/dialogs/action_new.rs b/crates/ui-egui/src/dialogs/action_new.rs index dab6013e1d..838331d7a7 100644 --- a/crates/ui-egui/src/dialogs/action_new.rs +++ b/crates/ui-egui/src/dialogs/action_new.rs @@ -4,7 +4,8 @@ //! Fields: `set` (the index of the set the action goes into), `name`, `key` (0 for none, 1 to 15 //! for F1 to F15), `cmd` (Ctrl, Command on macOS), `shift`, `color` (a value of //! [`crate::panels::actions::COLORS`], `""` for none). An invalid set or function key is an error: -//! Record then adds nothing and the dialog stays open. +//! Record then adds nothing and the dialog stays open. `automaticAlignTo` (false) chooses the live +//! selection's reference for Align at playback while keeping recorded step targets. use serde_json::{Value, json}; @@ -46,7 +47,7 @@ pub fn open(app: &mut VectorcraftApp) -> Result<(), String> { let Some(s) = app.ui.action_sets.get(set) else { return Err("no such action set".into()) }; let taken = |n: usize| s.actions.iter().any(|a| a.name == format!("Action {n}")); let n = (s.actions.len() + 1..).find(|&n| !taken(n)).unwrap_or(1); - let fields = json!({"set": set, "name": format!("Action {n}"), "key": 0, "cmd": false, "shift": false, "color": ""}); + let fields = json!({"set": set, "name": format!("Action {n}"), "key": 0, "cmd": false, "shift": false, "color": "", "automaticAlignTo": false}); app.ui.dialog = Some(Dialog::new(KIND, fields)); Ok(()) } @@ -64,6 +65,7 @@ fn body(app: &mut VectorcraftApp, ui: &mut egui::Ui, d: &mut Dialog) -> bool { } }); key_and_color(ui, d); + automatic_align_options(ui, d); false } @@ -94,6 +96,14 @@ pub(super) fn key_and_color(ui: &mut egui::Ui, d: &mut Dialog) { super::form::choice(ui, d, "color", "Color:", (LABEL_W, 120.0), &colors); } +/// The Align playback option shared by New Action and Action Options. +pub(super) fn automatic_align_options(ui: &mut egui::Ui, d: &mut Dialog) { + super::form::check(ui, d, "automaticAlignTo", "Choose Align To at playback"); + widgets::dim_label(ui, "Align steps use the key object, key anchor or key guide when one is set."); + widgets::dim_label(ui, "With one whole object selected and no key, they use the artboard."); + widgets::dim_label(ui, "Otherwise they use the selection."); +} + /// The function key and color params the dialog's fields give, as `ui.action.new` and /// `ui.action.options` take them. pub(super) fn key_and_color_params(d: &Dialog) -> Value { @@ -114,6 +124,9 @@ fn confirm(app: &mut VectorcraftApp, d: &Dialog) -> Result { let mut p = key_and_color_params(d); p["set"] = d.fields.get("set").cloned().unwrap_or(Value::Null); p["name"] = json!(name); + if let Some(value) = d.fields.get("automaticAlignTo") { + p["automaticAlignTo"] = value.clone(); + } app.run(crate::panels::actions::NEW_ACTION, p)?; app.ui.dialog = None; Ok(Value::Null) diff --git a/crates/ui-egui/src/dialogs/action_set_options.rs b/crates/ui-egui/src/dialogs/action_set_options.rs index 357f6e6840..660c36e07e 100644 --- a/crates/ui-egui/src/dialogs/action_set_options.rs +++ b/crates/ui-egui/src/dialogs/action_set_options.rs @@ -8,7 +8,8 @@ //! one, renames the set, or changes the action's name, function key and color //! (`ui.action.options`). An invalid `set`, `action` or function key is an error, and so is a name //! that would give the set a file that Load Actions… refuses (larger than 8 MiB). OK then changes no -//! set or action, and the dialog stays open. +//! set or action, and the dialog stays open. `automaticAlignTo` enables the live-selection Align +//! reference at playback without changing recorded targets. use serde_json::{Value, json}; @@ -52,7 +53,7 @@ pub fn open_action(app: &mut VectorcraftApp, set: usize, action: usize) { if let Some(a) = app.ui.action_sets.get(set).and_then(|s| s.actions.get(action)) { let (key, cmd, shift) = a.key.map_or((0, false, false), |k| (k.key, k.cmd, k.shift)); let color = a.color.clone().unwrap_or_default(); - let fields = json!({"set": set, "action": action, "name": a.name, "key": key, "cmd": cmd, "shift": shift, "color": color}); + let fields = json!({"set": set, "action": action, "name": a.name, "key": key, "cmd": cmd, "shift": shift, "color": color, "automaticAlignTo": a.automatic_align_to}); app.ui.dialog = Some(Dialog::new(KIND, fields)); } } @@ -65,6 +66,7 @@ fn body(_app: &mut VectorcraftApp, ui: &mut egui::Ui, d: &mut Dialog) -> bool { }); if action { super::action_new::key_and_color(ui, d); + super::action_new::automatic_align_options(ui, d); } false } @@ -82,6 +84,9 @@ fn confirm(app: &mut VectorcraftApp, d: &Dialog) -> Result { p["set"] = d.fields.get("set").cloned().unwrap_or(Value::Null); p["action"] = d.fields.get("action").cloned().unwrap_or(Value::Null); p["name"] = json!(name); + if let Some(value) = d.fields.get("automaticAlignTo") { + p["automaticAlignTo"] = value.clone(); + } app.run(crate::panels::actions::ACTION_OPTIONS, p)?; } else if let Some(set) = d.fields.get("set") { let i = set.as_u64().and_then(|i| usize::try_from(i).ok()).filter(|&i| i < app.ui.action_sets.len()).ok_or("no such action set")?; diff --git a/crates/ui-egui/src/i18n/bg.tsv b/crates/ui-egui/src/i18n/bg.tsv index d371a5f1e4..2e3862eda8 100644 --- a/crates/ui-egui/src/i18n/bg.tsv +++ b/crates/ui-egui/src/i18n/bg.tsv @@ -6527,6 +6527,10 @@ axis Y Axis Y ос Create New Action Създаване на ново действие Play Action Изпълнение на действие Action Set: Набор от действия: + Choose Align To at playback Избор на „Подравняване спрямо“ при възпроизвеждане + Align steps use the key object, key anchor or key guide when one is set. Стъпките за подравняване използват ключовия обект, ключовата опорна точка или ключовата направляваща, когато има такива. + With one whole object selected and no key, they use the artboard. При един изцяло избран обект и без ключ те използват работната област. + Otherwise they use the selection. Иначе те използват селекцията. Function Key: Функционален клавиш: Record Запис Create New Set Създаване на нов набор diff --git a/crates/ui-egui/src/i18n/bs.tsv b/crates/ui-egui/src/i18n/bs.tsv index 00d07d469d..7022e54ae4 100644 --- a/crates/ui-egui/src/i18n/bs.tsv +++ b/crates/ui-egui/src/i18n/bs.tsv @@ -6572,6 +6572,10 @@ axis Y Axis Y osa Create New Action Napravi novu akciju Play Action Reprodukuj akciju Action Set: Skup akcija: + Choose Align To at playback Odaberi „Poravnaj s“ pri reprodukciji + Align steps use the key object, key anchor or key guide when one is set. Koraci poravnanja koriste ključni objekt, ključnu sidrenu tačku ili ključnu vodilju kada je postavljen. + With one whole object selected and no key, they use the artboard. S jednim cijelim odabranim objektom i bez ključa koriste radnu ploču. + Otherwise they use the selection. Inače koriste odabir. Function Key: Funkcijska tipka: Record Snimi Create New Set Napravi novi skup diff --git a/crates/ui-egui/src/i18n/ca.tsv b/crates/ui-egui/src/i18n/ca.tsv index 78e5a77c9e..38ad585ab5 100644 --- a/crates/ui-egui/src/i18n/ca.tsv +++ b/crates/ui-egui/src/i18n/ca.tsv @@ -4763,6 +4763,10 @@ digits Malayalam Malaiàlam Create New Action Crea una acció nova Play Action Reprodueix l’acció Action Set: Conjunt d’accions: + Choose Align To at playback Tria «Alinea a» en la reproducció + Align steps use the key object, key anchor or key guide when one is set. Els passos d’alineació fan servir l’objecte clau, el punt d’ancoratge clau o la guia clau quan n’hi ha. + With one whole object selected and no key, they use the artboard. Amb un sol objecte sencer seleccionat i sense clau, fan servir el tauler. + Otherwise they use the selection. Altrament fan servir la selecció. Function Key: Tecla de funció: Record Enregistra Set Options… Defineix les opcions… diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv index bd3e76ec50..a249803b9a 100644 --- a/crates/ui-egui/src/i18n/cs.tsv +++ b/crates/ui-egui/src/i18n/cs.tsv @@ -7264,6 +7264,10 @@ axis Y Axis osa Y Create New Action Vytvořit novou akci Play Action Přehrát akci Action Set: Sada akcí: + Choose Align To at playback Volit „Zarovnat k“ při přehrávání + Align steps use the key object, key anchor or key guide when one is set. Kroky zarovnání použijí klíčový objekt, klíčový kotevní bod nebo klíčové vodítko, je-li nastaveno. + With one whole object selected and no key, they use the artboard. Při jednom celém vybraném objektu bez klíče použijí pracovní plochu. + Otherwise they use the selection. Jinak použijí výběr. Function Key: Funkční klávesa: Record Zaznamenat Create New Set Vytvořit novou sadu diff --git a/crates/ui-egui/src/i18n/da.tsv b/crates/ui-egui/src/i18n/da.tsv index 3fb128a27a..9832f5f3cd 100644 --- a/crates/ui-egui/src/i18n/da.tsv +++ b/crates/ui-egui/src/i18n/da.tsv @@ -9360,6 +9360,10 @@ axis Y Axis Y-akse Create New Action Opret ny handling Play Action Afspil handling Action Set: Handlingssæt: + Choose Align To at playback Vælg Juster til ved afspilning + Align steps use the key object, key anchor or key guide when one is set. Justeringstrin bruger nøgleobjektet, nøgleankerpunktet eller nøglehjælpelinjen, når en er angivet. + With one whole object selected and no key, they use the artboard. Med ét helt markeret objekt og ingen nøgle bruger de tegnebrættet. + Otherwise they use the selection. Ellers bruger de markeringen. Function Key: Funktionstast: Record Optag Create New Set Opret nyt sæt diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv index 6ad4e3850b..4d1ea2d4c3 100644 --- a/crates/ui-egui/src/i18n/de.tsv +++ b/crates/ui-egui/src/i18n/de.tsv @@ -6848,6 +6848,10 @@ axis Y Axis Y-Achse Create New Action Neue Aktion erstellen Play Action Aktion abspielen Action Set: Aktionssatz: + Choose Align To at playback „Ausrichten an“ bei der Wiedergabe wählen + Align steps use the key object, key anchor or key guide when one is set. Ausrichtungsschritte verwenden das Basisobjekt, den Basisankerpunkt oder die Basishilfslinie, wenn eines festgelegt ist. + With one whole object selected and no key, they use the artboard. Bei einem vollständig ausgewählten Objekt ohne Basis verwenden sie die Zeichenfläche. + Otherwise they use the selection. Sonst verwenden sie die Auswahl. Function Key: Funktionstaste: Record Aufzeichnen Create New Set Neuen Satz erstellen diff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsv index 7d2e5b6363..ea17c290df 100644 --- a/crates/ui-egui/src/i18n/el.tsv +++ b/crates/ui-egui/src/i18n/el.tsv @@ -7251,6 +7251,10 @@ axis Y Axis Άξονας Y Create New Action Δημιουργία νέας ενέργειας Play Action Αναπαραγωγή ενέργειας Action Set: Σύνολο ενεργειών: + Choose Align To at playback Επιλογή «Στοίχιση ως προς» κατά την αναπαραγωγή + Align steps use the key object, key anchor or key guide when one is set. Τα βήματα στοίχισης χρησιμοποιούν το βασικό αντικείμενο, το βασικό σημείο αγκύρωσης ή τον βασικό οδηγό, όταν έχει οριστεί. + With one whole object selected and no key, they use the artboard. Με ένα ολόκληρο επιλεγμένο αντικείμενο χωρίς βασικό, χρησιμοποιούν τον πίνακα σχεδίασης. + Otherwise they use the selection. Διαφορετικά χρησιμοποιούν την επιλογή. Function Key: Πλήκτρο λειτουργίας: Record Καταγραφή Create New Set Δημιουργία νέου συνόλου diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv index 30678f8a13..18bad0d0f7 100644 --- a/crates/ui-egui/src/i18n/es.tsv +++ b/crates/ui-egui/src/i18n/es.tsv @@ -7239,6 +7239,10 @@ axis Y Axis Eje Y Create New Action Crear nueva acción Play Action Reproducir acción Action Set: Conjunto de acciones: + Choose Align To at playback Elegir «Alinear con» durante la reproducción + Align steps use the key object, key anchor or key guide when one is set. Los pasos de alineación usan el objeto clave, el punto de ancla clave o la guía clave cuando hay uno. + With one whole object selected and no key, they use the artboard. Con un solo objeto entero seleccionado y sin clave, usan la mesa de trabajo. + Otherwise they use the selection. Si no, usan la selección. Function Key: Tecla de función: Record Grabar Create New Set Crear nuevo conjunto diff --git a/crates/ui-egui/src/i18n/fi.tsv b/crates/ui-egui/src/i18n/fi.tsv index 873d339833..e4557174ff 100644 --- a/crates/ui-egui/src/i18n/fi.tsv +++ b/crates/ui-egui/src/i18n/fi.tsv @@ -7328,6 +7328,10 @@ axis Y Axis Y-akseli Create New Action Luo uusi toiminto Play Action Toista toiminto Action Set: Toimintosarja: + Choose Align To at playback Valitse tasauskohde toistettaessa + Align steps use the key object, key anchor or key guide when one is set. Tasausvaiheet käyttävät avainobjektia, avainankkuripistettä tai avainapuviivaa, kun sellainen on asetettu. + With one whole object selected and no key, they use the artboard. Kun valittuna on yksi kokonainen objekti eikä avainta, ne käyttävät piirtoalustaa. + Otherwise they use the selection. Muuten ne käyttävät valintaa. Function Key: Toimintonäppäin: Record Nauhoita Create New Set Luo uusi sarja diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv index 68bcc455b2..6bfd7fbc48 100644 --- a/crates/ui-egui/src/i18n/fr.tsv +++ b/crates/ui-egui/src/i18n/fr.tsv @@ -7260,6 +7260,10 @@ axis Y Axis Axe Y Create New Action Créer un script Play Action Exécuter le script Action Set: Jeu de scripts : + Choose Align To at playback Choisir l’alignement à l’exécution + Align steps use the key object, key anchor or key guide when one is set. Les étapes d’alignement utilisent l’objet clé, le point d’ancrage clé ou le repère clé s’il y en a un. + With one whole object selected and no key, they use the artboard. Avec un seul objet entier sélectionné et sans clé, elles utilisent le plan de travail. + Otherwise they use the selection. Sinon, elles utilisent la sélection. Function Key: Touche de fonction : Record Enregistrer Create New Set Créer un jeu diff --git a/crates/ui-egui/src/i18n/gu.tsv b/crates/ui-egui/src/i18n/gu.tsv index d7bb081e02..e0145bb7e0 100644 --- a/crates/ui-egui/src/i18n/gu.tsv +++ b/crates/ui-egui/src/i18n/gu.tsv @@ -2799,6 +2799,10 @@ Plates પ્લેટ્સ Platform: પ્લેટફોર્મ: Play Action ક્રિયા ચલાવો + Choose Align To at playback પ્લેબેક વખતે સંરેખણ લક્ષ્ય પસંદ કરો + Align steps use the key object, key anchor or key guide when one is set. કી ઑબ્જેક્ટ, કી એન્કર બિંદુ અથવા કી માર્ગદર્શિકા સેટ હોય ત્યારે સંરેખણ પગલાં તેનો ઉપયોગ કરે છે. + With one whole object selected and no key, they use the artboard. એક આખો ઑબ્જેક્ટ પસંદ હોય અને કી ન હોય ત્યારે તે આર્ટબોર્ડનો ઉપયોગ કરે છે. + Otherwise they use the selection. અન્યથા તે પસંદગીનો ઉપયોગ કરે છે. Playback Options પ્લેબેક વિકલ્પો Plug-in Info પ્લગ-ઇન માહિતી Plug-ins પ્લગ-ઇન્સ diff --git a/crates/ui-egui/src/i18n/hi.tsv b/crates/ui-egui/src/i18n/hi.tsv index 2837a15b67..6214b58adf 100644 --- a/crates/ui-egui/src/i18n/hi.tsv +++ b/crates/ui-egui/src/i18n/hi.tsv @@ -2390,6 +2390,10 @@ antiAlias Sharp शार्प Full Width पूर्ण चौड़ाई Fully Inside पूरी तरह से अंदर Fully Outside पूरी तरह बाहर + Choose Align To at playback प्लेबैक के समय संरेखण लक्ष्य चुनें + Align steps use the key object, key anchor or key guide when one is set. मुख्य ऑब्जेक्ट, मुख्य एंकर पॉइंट या मुख्य गाइड सेट होने पर संरेखण चरण उसका उपयोग करते हैं। + With one whole object selected and no key, they use the artboard. एक पूरा ऑब्जेक्ट चुना हो और कोई मुख्य न हो, तो वे आर्टबोर्ड का उपयोग करते हैं। + Otherwise they use the selection. अन्यथा वे सिलेक्शन का उपयोग करते हैं। Function Key: फ़ंक्शन की: Fuzziness: फ़ज़ीनेस: Gamma गामा diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv index fbc2e30bd1..a1b4db79f3 100644 --- a/crates/ui-egui/src/i18n/hu.tsv +++ b/crates/ui-egui/src/i18n/hu.tsv @@ -7248,6 +7248,10 @@ axis Y Axis Y tengely Create New Action Új művelet létrehozása Play Action Művelet lejátszása Action Set: Műveletkészlet: + Choose Align To at playback Igazítási cél választása lejátszáskor + Align steps use the key object, key anchor or key guide when one is set. Az igazítási lépések a kulcsobjektumot, a kulcs-horgonypontot vagy a kulcssegédvonalat használják, ha van ilyen. + With one whole object selected and no key, they use the artboard. Egy teljes egészében kijelölt objektummal és kulcs nélkül a rajztáblát használják. + Otherwise they use the selection. Egyébként a kijelölést használják. Function Key: Funkcióbillentyű: Record Felvétel Create New Set Új készlet létrehozása diff --git a/crates/ui-egui/src/i18n/id.tsv b/crates/ui-egui/src/i18n/id.tsv index ab48475d3d..603ab85821 100644 --- a/crates/ui-egui/src/i18n/id.tsv +++ b/crates/ui-egui/src/i18n/id.tsv @@ -6543,6 +6543,10 @@ axis Y Axis Sumbu Y Create New Action Buat tindakan baru Play Action Putar tindakan Action Set: Set tindakan: + Choose Align To at playback Pilih Ratakan ke saat pemutaran + Align steps use the key object, key anchor or key guide when one is set. Langkah perataan memakai objek kunci, titik jangkar kunci, atau panduan kunci jika ada. + With one whole object selected and no key, they use the artboard. Dengan satu objek utuh terpilih dan tanpa kunci, langkah memakai artboard. + Otherwise they use the selection. Jika tidak, langkah memakai seleksi. Function Key: Tombol fungsi: Record Rekam Create New Set Buat set baru diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv index a3b493cd1d..f87503d2fd 100644 --- a/crates/ui-egui/src/i18n/it.tsv +++ b/crates/ui-egui/src/i18n/it.tsv @@ -6887,6 +6887,10 @@ axis Y Axis Asse Y Create New Action Crea nuova azione Play Action Esegui azione Action Set: Set di azioni: + Choose Align To at playback Scegli Allinea a durante la riproduzione + Align steps use the key object, key anchor or key guide when one is set. I passaggi di allineamento usano l'oggetto chiave, il punto di ancoraggio chiave o la guida chiave, se impostati. + With one whole object selected and no key, they use the artboard. Con un solo oggetto intero selezionato e senza chiave, usano la tavola da disegno. + Otherwise they use the selection. Altrimenti usano la selezione. Function Key: Tasto funzione: Record Registra Create New Set Crea nuovo set diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv index 5de0cae50c..454d757c5a 100644 --- a/crates/ui-egui/src/i18n/ja.tsv +++ b/crates/ui-egui/src/i18n/ja.tsv @@ -8777,6 +8777,10 @@ axis Y Axis Y 軸 Create New Action 新規アクションを作成 Play Action アクションを再生 Action Set: アクションセット: + Choose Align To at playback 再生時に整列の基準を選択 + Align steps use the key object, key anchor or key guide when one is set. キーオブジェクト、キーアンカーポイントまたはキーガイドがある場合、整列ステップはそれを使います。 + With one whole object selected and no key, they use the artboard. オブジェクト全体を 1 つだけ選択し、キーがない場合はアートボードを使います。 + Otherwise they use the selection. それ以外の場合は選択範囲を使います。 Function Key: ファンクションキー: Record 記録 Create New Set 新規セットを作成 diff --git a/crates/ui-egui/src/i18n/ka.tsv b/crates/ui-egui/src/i18n/ka.tsv index 81fc06870d..187613efb1 100644 --- a/crates/ui-egui/src/i18n/ka.tsv +++ b/crates/ui-egui/src/i18n/ka.tsv @@ -9388,6 +9388,10 @@ axis Y Axis Y ღერძი Create New Action ახალი მოქმედების შექმნა Play Action მოქმედების შესრულება Action Set: მოქმედებების ნაკრები: + Choose Align To at playback შესრულებისას სწორების სამიზნის არჩევა + Align steps use the key object, key anchor or key guide when one is set. სწორების ნაბიჯები იყენებს საკვანძო ობიექტს, საკვანძო საყრდენ წერტილს ან საკვანძო დამხმარე ხაზს, თუ ის მითითებულია. + With one whole object selected and no key, they use the artboard. ერთი მთლიანი მონიშნული ობიექტისას და გასაღების გარეშე ისინი იყენებს სამუშაო დაფას. + Otherwise they use the selection. სხვა შემთხვევაში ისინი იყენებს მონიშნულს. Function Key: ფუნქციური კლავიში: Record ჩაწერა Create New Set ახალი ნაკრების შექმნა diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv index 4a6963bbd2..80b72678be 100644 --- a/crates/ui-egui/src/i18n/ko.tsv +++ b/crates/ui-egui/src/i18n/ko.tsv @@ -6859,6 +6859,10 @@ axis Y Axis Y축 Create New Action 새 액션 만들기 Play Action 액션 재생 Action Set: 액션 세트: + Choose Align To at playback 재생 시 정렬 대상 선택 + Align steps use the key object, key anchor or key guide when one is set. 키 개체, 키 앵커 포인트 또는 키 안내선이 설정되어 있으면 정렬 단계는 그것을 사용합니다. + With one whole object selected and no key, they use the artboard. 개체 하나 전체만 선택되어 있고 키가 없으면 아트보드를 사용합니다. + Otherwise they use the selection. 그 밖에는 선택 영역을 사용합니다. Function Key: 기능 키: Record 기록 Create New Set 새 세트 만들기 diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsv index 894c7096f6..cee0abebb1 100644 --- a/crates/ui-egui/src/i18n/nl.tsv +++ b/crates/ui-egui/src/i18n/nl.tsv @@ -9198,6 +9198,10 @@ axis Y Axis Y-as Create New Action Nieuwe actie maken Play Action Actie afspelen Action Set: Actieset: + Choose Align To at playback Uitlijnen op kiezen bij afspelen + Align steps use the key object, key anchor or key guide when one is set. Uitlijnstappen gebruiken het sleutelobject, het sleutelankerpunt of de sleutelhulplijn als die is ingesteld. + With one whole object selected and no key, they use the artboard. Met één volledig geselecteerd object en geen sleutel gebruiken ze het tekengebied. + Otherwise they use the selection. Anders gebruiken ze de selectie. Function Key: Functietoets: Record Opnemen Create New Set Nieuwe set maken diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv index c69ed2cf28..42f037e4eb 100644 --- a/crates/ui-egui/src/i18n/pl.tsv +++ b/crates/ui-egui/src/i18n/pl.tsv @@ -7117,6 +7117,10 @@ axis Y Axis Oś Y Create New Action Utwórz nową operację Play Action Odtwórz operację Action Set: Zestaw operacji: + Choose Align To at playback Wybieraj „Wyrównaj do” podczas odtwarzania + Align steps use the key object, key anchor or key guide when one is set. Kroki wyrównania używają obiektu kluczowego, kluczowego punktu kontrolnego lub prowadnicy kluczowej, gdy jest ustawiona. + With one whole object selected and no key, they use the artboard. Przy jednym zaznaczonym w całości obiekcie i braku klucza używają obszaru kompozycji. + Otherwise they use the selection. W przeciwnym razie używają zaznaczenia. Function Key: Klawisz funkcyjny: Record Nagraj Create New Set Utwórz nowy zestaw diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv index 6bae5e26f1..50b353d789 100644 --- a/crates/ui-egui/src/i18n/pt-br.tsv +++ b/crates/ui-egui/src/i18n/pt-br.tsv @@ -7163,6 +7163,10 @@ axis Y Axis Eixo Y Create New Action Criar Nova Ação Play Action Reproduzir Ação Action Set: Conjunto de Ações: + Choose Align To at playback Escolher Alinhar a na reprodução + Align steps use the key object, key anchor or key guide when one is set. As etapas de alinhamento usam o objeto-chave, o ponto de ancoragem-chave ou a guia-chave quando definidos. + With one whole object selected and no key, they use the artboard. Com um só objeto inteiro selecionado e sem chave, usam a prancheta. + Otherwise they use the selection. Caso contrário, usam a seleção. Function Key: Tecla de Função: Record Gravar Create New Set Criar Novo Conjunto diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv index 74156da429..88c56cdec7 100644 --- a/crates/ui-egui/src/i18n/ru.tsv +++ b/crates/ui-egui/src/i18n/ru.tsv @@ -6887,6 +6887,10 @@ axis Y Axis Ось Y Create New Action Создать новое действие Play Action Воспроизвести действие Action Set: Набор действий: + Choose Align To at playback Выбирать «Выравнивать по» при воспроизведении + Align steps use the key object, key anchor or key guide when one is set. Шаги выравнивания используют ключевой объект, ключевую опорную точку или ключевую направляющую, если они заданы. + With one whole object selected and no key, they use the artboard. Если выделен один объект целиком и ключа нет, используется монтажная область. + Otherwise they use the selection. Иначе используется выделение. Function Key: Функциональная клавиша: Record Записать Create New Set Создать новый набор diff --git a/crates/ui-egui/src/i18n/sv.tsv b/crates/ui-egui/src/i18n/sv.tsv index 4d683cb1ea..2a7f0501ce 100644 --- a/crates/ui-egui/src/i18n/sv.tsv +++ b/crates/ui-egui/src/i18n/sv.tsv @@ -7270,6 +7270,10 @@ axis Y Axis Y-axel Create New Action Skapa ny åtgärd Play Action Spela upp åtgärd Action Set: Åtgärdsuppsättning: + Choose Align To at playback Välj Justera mot vid uppspelning + Align steps use the key object, key anchor or key guide when one is set. Justeringssteg använder nyckelobjektet, nyckelankarpunkten eller nyckelstödlinjen när en sådan är angiven. + With one whole object selected and no key, they use the artboard. Med ett helt markerat objekt och ingen nyckel använder de ritytan. + Otherwise they use the selection. Annars använder de markeringen. Function Key: Funktionstangent: Record Spela in Create New Set Skapa ny uppsättning diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsv index d0e30b8fdc..af4aee3d4d 100644 --- a/crates/ui-egui/src/i18n/tr.tsv +++ b/crates/ui-egui/src/i18n/tr.tsv @@ -9154,6 +9154,10 @@ axis Y Axis Y ekseni Create New Action Yeni Eylem Oluştur Play Action Eylemi Oynat Action Set: Eylem Seti: + Choose Align To at playback Oynatma sırasında hizalama hedefini seç + Align steps use the key object, key anchor or key guide when one is set. Hizalama adımları, ayarlıysa anahtar nesneyi, anahtar bağlantı noktasını veya anahtar kılavuzu kullanır. + With one whole object selected and no key, they use the artboard. Tek bir nesnenin tamamı seçiliyken ve anahtar yokken çalışma yüzeyini kullanırlar. + Otherwise they use the selection. Aksi halde seçimi kullanırlar. Function Key: İşlev Tuşu: Record Kayıt Create New Set Yeni Set Oluştur diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv index 82ba9af243..a1d166ff4e 100644 --- a/crates/ui-egui/src/i18n/uk.tsv +++ b/crates/ui-egui/src/i18n/uk.tsv @@ -6869,6 +6869,10 @@ axis Y Axis Вісь Y Create New Action Створити нову дію Play Action Відтворити дію Action Set: Набір дій: + Choose Align To at playback Вибирати «Вирівнювати за» під час відтворення + Align steps use the key object, key anchor or key guide when one is set. Кроки вирівнювання використовують ключовий об’єкт, ключову опорну точку або ключову напрямну, якщо їх задано. + With one whole object selected and no key, they use the artboard. Якщо виділено один об’єкт повністю і ключа немає, використовується монтажна область. + Otherwise they use the selection. Інакше використовується виділення. Function Key: Функціональна клавіша: Record Записати Create New Set Створити новий набір diff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsv index 04ebd9992d..412d0769cc 100644 --- a/crates/ui-egui/src/i18n/vi.tsv +++ b/crates/ui-egui/src/i18n/vi.tsv @@ -6913,6 +6913,10 @@ axis Y Axis Trục Y Create New Action Tạo hành động mới Play Action Phát hành động Action Set: Bộ hành động: + Choose Align To at playback Chọn Căn theo khi phát lại + Align steps use the key object, key anchor or key guide when one is set. Các bước căn dùng đối tượng chính, điểm neo chính hoặc đường gióng chính khi có. + With one whole object selected and no key, they use the artboard. Khi chỉ chọn trọn một đối tượng và không có khóa, các bước dùng bảng vẽ. + Otherwise they use the selection. Nếu không, các bước dùng vùng chọn. Function Key: Phím chức năng: Record Ghi Create New Set Tạo bộ mới diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv index d20ae8d9e8..54abfab1f8 100644 --- a/crates/ui-egui/src/i18n/zh-hans.tsv +++ b/crates/ui-egui/src/i18n/zh-hans.tsv @@ -7098,6 +7098,10 @@ axis Y Axis Y 轴 Create New Action 创建新动作 Play Action 播放动作 Action Set: 动作组: + Choose Align To at playback 播放时选择对齐目标 + Align steps use the key object, key anchor or key guide when one is set. 设置了关键对象、关键锚点或关键参考线时,对齐步骤使用它。 + With one whole object selected and no key, they use the artboard. 只选中一个完整对象且未设置关键项时,使用画板。 + Otherwise they use the selection. 否则使用所选对象。 Function Key: 功能键: Record 记录 Create New Set 创建新组 diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv index d5fde762f9..ed5752782b 100644 --- a/crates/ui-egui/src/i18n/zh-hant.tsv +++ b/crates/ui-egui/src/i18n/zh-hant.tsv @@ -6918,6 +6918,10 @@ axis Y Axis Y 軸 Create New Action 建立新動作 Play Action 播放動作 Action Set: 動作組: + Choose Align To at playback 播放時選擇對齊目標 + Align steps use the key object, key anchor or key guide when one is set. 設定了關鍵物件、關鍵錨點或關鍵參考線時,對齊步驟使用它。 + With one whole object selected and no key, they use the artboard. 只選取一個完整物件且未設定關鍵項時,使用工作區域。 + Otherwise they use the selection. 否則使用選取範圍。 Function Key: 功能鍵: Record 錄製 Create New Set 建立新組 diff --git a/crates/ui-egui/src/menus/ui_commands.rs b/crates/ui-egui/src/menus/ui_commands.rs index fbfd12b24e..a2a222aa8a 100644 --- a/crates/ui-egui/src/menus/ui_commands.rs +++ b/crates/ui-egui/src/menus/ui_commands.rs @@ -1661,13 +1661,13 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[ crate::panels::actions::NEW_ACTION, "New Action", "", - "{set: index, name, key?: 0-15, cmd?, shift?, color?: red|yellow|green|blue|violet} add an action named name (spaces trimmed from both ends) after the last action of the Actions panel's set at set (0 is the top set) and start recording into it; Stop Playing/Recording (ui.action.stop) ends the recording. key 1 to 15 is the function key F1 to F15 that plays the action (0 or null: none), with cmd (Ctrl, Command on macOS) and shift; color is its Button Mode color (null or \"\": none), the color of its button in Button Mode (ui.action.buttonMode). Action function keys take priority over command shortcuts and preserve the command's binding. On Windows F1, Ctrl+F4 and Ctrl+F6 cannot be used. The set becomes current and the new action is selected. The panel's Create New Action button and menu's New Action… (dialog `actionNew` with set, name, key, cmd, shift and color) run this on Record. While an action is recording, and for an index past the last set, an empty name, a key or color that is not one of these, or an action that would give the set more than 1,000 actions or an action set file larger than 8 MiB, it is an error, nothing is added and no recording starts → {set, action}", + "{set: index, name, key?: 0-15, cmd?, shift?, color?: red|yellow|green|blue|violet, automaticAlignTo?: bool} add an action named name (spaces trimmed from both ends) after the last action of the Actions panel's set at set (0 is the top set) and start recording into it; Stop Playing/Recording (ui.action.stop) ends the recording. key 1 to 15 is the function key F1 to F15 that plays the action (0 or null: none), with cmd (Ctrl, Command on macOS) and shift; color is its Button Mode color (null or \"\": none), the color of its button in Button Mode (ui.action.buttonMode). Action function keys take priority over command shortcuts and preserve the command's binding. On Windows F1, Ctrl+F4 and Ctrl+F6 cannot be used. automaticAlignTo (false when omitted or null) makes each object.align choose its reference at playback: an active key object, key anchor or key guide, else the artboard for one whole selected object, else the selection; false uses the recorded target, and stored steps stay unchanged. The set becomes current and the new action is selected. The panel's Create New Action button and menu's New Action… (dialog `actionNew` with set, name, key, cmd, shift, color and automaticAlignTo) run this on Record. While an action is recording, and for an index past the last set, an empty name, a key or color that is not one of these, or an action that would give the set more than 1,000 actions or an action set file larger than 8 MiB, it is an error, nothing is added and no recording starts → {set, action}", ), ( crate::panels::actions::ACTION_OPTIONS, "Action Options", "", - "{set: index, action: index, name?, key?: 0-15, cmd?, shift?, color?: red|yellow|green|blue|violet} change the Actions panel's action at action in set (0 is the top set); its steps stay. name renames it (spaces trimmed from both ends), key 1 to 15 with cmd (Ctrl, Command on macOS) and shift sets the function key F1 to F15 that plays it (0 or null: none), and color sets its Button Mode color (null or \"\": none); a param left out keeps what the action has, and cmd or shift alone changes that modifier of its key. Action function keys take priority over command shortcuts and preserve the command's binding. The panel menu's Action Options… (dialog `actionSetOptions` with set, action, name, key, cmd, shift and color) runs this for the selected action. An index past the last set or action, an empty name, a key or color that is not one of these, or a change that would give the set's action set file more than 8 MiB (counting the steps the recording in progress adds to it; a change that leaves the file as large or makes it smaller is never refused) is an error and changes nothing → {name, key, color}", + "{set: index, action: index, name?, key?: 0-15, cmd?, shift?, color?: red|yellow|green|blue|violet, automaticAlignTo?: bool} change the Actions panel's action at action in set (0 is the top set); its steps stay. name renames it (spaces trimmed from both ends), key 1 to 15 with cmd (Ctrl, Command on macOS) and shift sets the function key F1 to F15 that plays it (0 or null: none), and color sets its Button Mode color (null or \"\": none); a param left out keeps what the action has, and cmd or shift alone changes that modifier of its key. automaticAlignTo overrides each object.align reference at playback with the current key object, key anchor or key guide, else the artboard for one whole selected object, else the selection; false uses the unchanged recorded targets, and omission or null keeps the option. Action function keys take priority over command shortcuts and preserve the command's binding. The panel menu's Action Options… (dialog `actionSetOptions` with set, action, name, key, cmd, shift, color and automaticAlignTo) runs this for the selected action. An index past the last set or action, an empty name, a key or color that is not one of these, or a change that would give the set's action set file more than 8 MiB (counting the steps the recording in progress adds to it; a change that leaves the file as large or makes it smaller is never refused) is an error and changes nothing → {name, key, color, automaticAlignTo}", ), ( crate::panels::actions::PLAY_ACTION, diff --git a/crates/ui-egui/src/panels/actions.rs b/crates/ui-egui/src/panels/actions.rs index a350a0e842..4fc65c2e6e 100644 --- a/crates/ui-egui/src/panels/actions.rs +++ b/crates/ui-egui/src/panels/actions.rs @@ -23,6 +23,9 @@ pub struct Action { #[serde(skip, default = "next_action_id")] pub id: u64, pub name: String, + /// Use the live selection's reference for Align during playback; stored step params stay as recorded. + #[serde(default, rename = "automaticAlignTo", skip_serializing_if = "files::is_false")] + pub automatic_align_to: bool, pub steps: Vec<(String, Value)>, /// Step indexes omitted from playback. A sidecar keeps existing recorded command pairs and /// their params unchanged; newly recorded steps are included by default. @@ -40,9 +43,9 @@ pub struct Action { } impl Action { - /// An action with a new [`Action::id`], no function key and no color. + /// An action with a new [`Action::id`], recorded Align targets, no function key and no color. pub fn new(name: impl Into, steps: Vec<(String, Value)>) -> Self { - Self { id: next_action_id(), name: name.into(), steps, excluded_steps: BTreeSet::new(), key: None, color: None } + Self { id: next_action_id(), name: name.into(), automatic_align_to: false, steps, excluded_steps: BTreeSet::new(), key: None, color: None } } /// A copy of the action with a new [`Action::id`] and no function key, so the key still plays @@ -73,7 +76,9 @@ impl Action { /// The included steps as `command.batch` takes them. A recorded `command.batch` step (an action /// played, or a panel operation that runs as one batch, while recording) gives its own steps, - /// since batches do not nest. + /// since batches do not nest. With [`Action::automatic_align_to`], each `object.align` copy, also + /// one in a recorded Batch run (`action.batch`), gets `to: "auto"` and loses any stored + /// `artboard`; the stored steps keep their recorded params. pub(crate) fn included_commands(&self) -> Vec { self.playback_steps().into_iter().map(|s| s.command).collect() } @@ -89,6 +94,17 @@ impl Action { Some(steps) if command == "command.batch" => steps.iter().map(|c| PlayStep { row, command: c.clone() }).collect(), _ => vec![PlayStep { row, command: json!({"command": command, "params": params}) }], }) + .map(|mut play| { + if self.automatic_align_to { + automatic_align(&mut play.command); + if play.command.get("command").and_then(Value::as_str) == Some("action.batch") + && let Some(Value::Array(steps)) = play.command.get_mut("params").and_then(|p| p.get_mut("commands")) + { + steps.iter_mut().for_each(automatic_align); + } + } + play + }) .collect() } @@ -165,6 +181,23 @@ struct PlayStep { command: Value, } +/// Gives `step`, a command as `command.batch` takes it, `to: "auto"` and no `artboard` when it is +/// an `object.align` step ([`Action::automatic_align_to`]); other steps stay as they are. +fn automatic_align(step: &mut Value) { + if step.get("command").and_then(Value::as_str) != Some("object.align") { + return; + } + let Some(step) = step.as_object_mut() else { return }; + let params = step.entry("params").or_insert_with(|| json!({})); + if params.is_null() { + *params = json!({}); + } + if let Some(params) = params.as_object_mut() { + params.insert("to".into(), json!("auto")); + params.remove("artboard"); + } +} + /// An action id no other action in this run has. fn next_action_id() -> u64 { static NEXT: std::sync::atomic::AtomicU64 = std::sync::atomic::AtomicU64::new(1); @@ -917,15 +950,25 @@ pub fn rename_action(app: &mut VectorcraftApp, p: &Value) -> Result Result, String> { + match p.get("automaticAlignTo") { + None | Some(Value::Null) => Ok(None), + Some(value) => value.as_bool().map(Some).ok_or_else(|| "automaticAlignTo must be true or false".into()), + } +} + /// The command that makes an action and records into it ([`new_action`]). pub const NEW_ACTION: &str = "ui.action.new"; -/// `ui.action.new {set, name, key?, cmd?, shift?, color?}`: adds an action named `name` +/// `ui.action.new {set, name, key?, cmd?, shift?, color?, automaticAlignTo?}`: adds an action named `name` /// (spaces trimmed from both ends) after the last action of set `set` (0 is the top set) and starts /// recording into it; Stop Playing/Recording ends the recording. `key` (1 to 15, F1 to F15; 0 or /// null for none) with `cmd` (Ctrl, Command on macOS) and `shift` is the function key that plays /// it, and `color` (one of [`COLORS`]; null or `""` for none) its Button Mode color. The action's -/// function key takes priority over command shortcuts. The set becomes current and the only selected set, and the new action is selected. While an +/// `automaticAlignTo` chooses Align's reference from the live selection at playback, false by default; +/// its recorded step params stay as they are. The function key takes priority over command shortcuts. +/// The set becomes current and the only selected set, and the new action is selected. While an /// action is recording, and for an index past the last set, an empty name, a key or color that is /// not one of them, or an action that would give the set a file that Load Actions… refuses /// ([`edit_keeps_set_loadable`]: 1,000 actions, 8 MiB), nothing is added. The New Action dialog's Record runs this. → {set, action} @@ -941,10 +984,11 @@ pub fn new_action(app: &mut VectorcraftApp, p: &Value) -> Result } let key = FunctionKey::from_params(p)?; let color = color_param(p)?; + let automatic_align_to = automatic_align_to_param(p)?.unwrap_or(false); if let Some(message) = key.and_then(key_error) { return Err(message); } - let action = Action { key, color, ..Action::new(name.clone(), vec![]) }; + let action = Action { key, color, automatic_align_to, ..Action::new(name.clone(), vec![]) }; let id = action.id; let Some(mut edited) = app.ui.action_sets.get(set).cloned() else { return Err("no such action set".into()) }; edited.actions.push(action); @@ -963,16 +1007,18 @@ pub fn new_action(app: &mut VectorcraftApp, p: &Value) -> Result /// The command that changes an action's name, function key and color ([`action_options`]). pub const ACTION_OPTIONS: &str = "ui.action.options"; -/// `ui.action.options {set, action, name?, key?, cmd?, shift?, color?}`: changes the +/// `ui.action.options {set, action, name?, key?, cmd?, shift?, color?, automaticAlignTo?}`: changes the /// action at index `action` of set `set` (0 is the top set) and keeps its steps. `name` renames it /// (spaces trimmed from both ends), `key` (1 to 15, F1 to F15; 0 or null for none) with `cmd` /// (Ctrl, Command on macOS) and `shift` sets the function key that plays it, and `color` (one of /// [`COLORS`]; null or `""` for none) its Button Mode color; a param left out keeps what the action -/// has, and `cmd` or `shift` alone changes that modifier of the action's key. The action's function -/// key takes priority over command shortcuts. An index past the last set or action, an empty name, +/// has, and `cmd` or `shift` alone changes that modifier of the action's key. `automaticAlignTo` +/// chooses Align's reference from the live selection at playback; false uses the recorded targets, +/// and omission or null keeps the choice. Stored steps stay unchanged. The action's function key +/// takes priority over command shortcuts. An index past the last set or action, an empty name, /// a key or color that is not one of them, or a change that would give the set a file that Load /// Actions… refuses ([`edit_keeps_set_loadable`]) is an error, and then nothing changes. The panel -/// menu's Action Options… runs this for the selected action. → {name, key, color} +/// menu's Action Options… runs this for the selected action. → {name, key, color, automaticAlignTo} pub fn action_options(app: &mut VectorcraftApp, p: &Value) -> Result { let index = |k: &str| p.get(k).and_then(Value::as_u64).and_then(|i| usize::try_from(i).ok()); let (set, at) = index("set").zip(index("action")).ok_or("no such action")?; @@ -996,6 +1042,7 @@ pub fn action_options(app: &mut VectorcraftApp, p: &Value) -> Result Result, #[serde(default, skip_serializing_if = "Option::is_none", deserialize_with = "super::deserialize_color")] color: Option, + #[serde(default, rename = "automaticAlignTo", skip_serializing_if = "is_false")] + automatic_align_to: bool, } /// A step of an action in an action set file: a command id and its params, as `command.batch` @@ -79,7 +83,7 @@ struct FileStep { excluded: bool, } -fn is_false(value: &bool) -> bool { +pub(super) fn is_false(value: &bool) -> bool { !value } @@ -197,6 +201,20 @@ fn folder_pref_in(command: &str, params: &Value) -> Option { } } +/// Whether the raw step stores automatic Align semantics, including in excluded recorded batches and +/// in the steps of a recorded Batch run (`action.batch`). +fn automatic_align_in(command: &str, params: &Value) -> bool { + match command { + "object.align" => params.get("to").and_then(Value::as_str) == Some("auto"), + "command.batch" | "action.batch" => params.get("commands").and_then(Value::as_array).is_some_and(|steps| { + steps.iter().any(|step| { + automatic_align_in(step.get("command").and_then(Value::as_str).unwrap_or_default(), step.get("params").unwrap_or(&Value::Null)) + }) + }), + _ => false, + } +} + /// `set` as the text of an action set file. pub fn write_set(set: &ActionSet) -> String { let actions = set @@ -212,6 +230,7 @@ pub fn write_set(set: &ActionSet) -> String { .collect(), key: a.key, color: a.color.clone(), + automatic_align_to: a.automatic_align_to, }) .collect(); let steps = || set.actions.iter().flat_map(|a| &a.steps); @@ -219,7 +238,10 @@ pub fn write_set(set: &ActionSet) -> String { let has_select_path = steps().any(|(command, params)| !select_paths_in(command, params).is_empty()); let has_stop = steps().any(|(command, params)| !stops_in(command, params).is_empty()); let has_ui_step = steps().any(|(command, params)| !ui_steps_in(command, params).is_empty()); + let has_automatic_align = + set.actions.iter().any(|a| a.automatic_align_to || a.steps.iter().any(|(command, params)| automatic_align_in(command, params))); let version = match (has_select_path, has_select_object, has_stop, set.actions.iter().any(|a| !a.excluded_steps.is_empty())) { + _ if has_automatic_align => 7, _ if has_ui_step => 6, (true, ..) => 5, (false, true, ..) => 4, @@ -240,7 +262,7 @@ pub fn read_set(text: &str, name: &str) -> Result { if f.format != ACTIONS_EXT { return Err("not an action set file".into()); } - if !matches!(f.version, 1..=6) { + if !matches!(f.version, 1..=7) { return Err("the action set file needs a later version of VectorCraft".into()); } if f.actions.len() > MAX_SET_ACTIONS { @@ -270,7 +292,13 @@ pub fn read_set(text: &str, name: &str) -> Result { .into_iter() .map(|a| { let excluded_steps = a.steps.iter().enumerate().filter_map(|(i, step)| step.excluded.then_some(i)).collect(); - Action { key: a.key, color: a.color, excluded_steps, ..Action::new(a.name, a.steps.into_iter().map(|s| (s.command, s.params)).collect()) } + Action { + key: a.key, + color: a.color, + automatic_align_to: a.automatic_align_to, + excluded_steps, + ..Action::new(a.name, a.steps.into_iter().map(|s| (s.command, s.params)).collect()) + } }) .collect(); let set_name = if f.name.trim().is_empty() { name.to_string() } else { f.name }; diff --git a/crates/ui-egui/tests/actions_automatic_align.rs b/crates/ui-egui/tests/actions_automatic_align.rs new file mode 100644 index 0000000000..03191de97b --- /dev/null +++ b/crates/ui-egui/tests/actions_automatic_align.rs @@ -0,0 +1,392 @@ +//! An action's opt-in Align To follows the selection at playback without rewriting its recording. +// Integration tests may unwrap and panic (AGENTS.md, Robustness). +#![allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)] + +use std::sync::Mutex; + +use serde_json::{Value, json}; +use vectorcraft_doc::{Document, NodeId}; +use vectorcraft_engine::Session; +use vectorcraft_ui_egui::panels::actions::{self, ActionSet}; +use vectorcraft_ui_egui::{UiState, VectorcraftApp}; + +static CASE: Mutex<()> = Mutex::new(()); + +struct CenterRecording { + document: Document, + a: NodeId, + b: NodeId, + ui: Value, + raw_steps: Value, +} + +fn bounds(app: &VectorcraftApp, id: NodeId) -> [f64; 4] { + let b = app.session.active().unwrap().doc.node(id).unwrap().geometric_bounds().unwrap(); + [b.x0, b.y0, b.x1, b.y1] +} + +fn close(actual: [f64; 4], expected: [f64; 4]) -> bool { + actual.into_iter().zip(expected).all(|(a, e)| (a - e).abs() < 1e-8) +} + +/// Record Center exactly once through New Action, the two actual Align commands, and Stop. +fn record_center(automatic: bool) -> CenterRecording { + let mut app = VectorcraftApp::new(Session::new(), Default::default()); + app.run("file.new", json!({"width": 400, "height": 300, "profile": null})).unwrap(); + app.run("paint.setStroke", json!({"none": true})).unwrap(); + let a = NodeId(app.run("shape.rectangle", json!({"x": 20, "y": 40, "width": 40, "height": 20})).unwrap()["id"].as_u64().unwrap()); + let b = NodeId(app.run("shape.rectangle", json!({"x": 180, "y": 120, "width": 80, "height": 60})).unwrap()["id"].as_u64().unwrap()); + let document = (*app.session.active().unwrap().doc).clone(); + assert!(close(bounds(&app, a), [20.0, 40.0, 60.0, 60.0])); + assert!(close(bounds(&app, b), [180.0, 120.0, 260.0, 180.0])); + app.run("select.set", json!({"ids": [a.0, b.0]})).unwrap(); + app.run("select.key", json!({"id": b.0})).unwrap(); + app.ui.action_sets = vec![ActionSet::new("Automatic Align", vec![])]; + let new_action = if automatic { json!({"set": 0, "name": "Center", "automaticAlignTo": true}) } else { json!({"set": 0, "name": "Center"}) }; + app.run(actions::NEW_ACTION, new_action).unwrap(); + app.run("object.align", json!({"horizontal": "center", "to": "key"})).unwrap(); + app.run("object.align", json!({"vertical": "center", "to": "key"})).unwrap(); + app.run(actions::STOP_RECORDING, json!({})).unwrap(); + let action = &app.ui.action_sets[0].actions[0]; + assert_eq!(action.steps.len(), 2); + assert!(action.steps.iter().all(|(id, p)| id == "object.align" && p["to"] == "key")); + assert_eq!(action.automatic_align_to, automatic, "New Action sets the option it is given"); + let raw_steps = serde_json::to_value(&action.steps).unwrap(); + let ui = serde_json::to_value(&app.ui).unwrap(); + CenterRecording { document, a, b, ui, raw_steps } +} + +fn playback_app(recording: &CenterRecording, only_a: bool, key: bool) -> VectorcraftApp { + let mut session = Session::new(); + session.add_document(recording.document.clone(), None); + let mut app = VectorcraftApp::new(session, Default::default()); + // Real UiState serialization/deserialization, not a separately authored Center action. + app.ui = serde_json::from_slice::(&serde_json::to_vec(&recording.ui).unwrap()).unwrap(); + let ids = if only_a { vec![recording.a.0] } else { vec![recording.a.0, recording.b.0] }; + app.run("select.set", json!({"ids": ids})).unwrap(); + if key { + app.run("select.key", json!({"id": recording.b.0})).unwrap(); + } else { + app.run("select.key", json!({})).unwrap(); + } + app +} + +#[derive(Debug)] +struct Observation { + label: &'static str, + result: Result, + actual: [[f64; 4]; 2], + expected: [[f64; 4]; 2], + raw_unchanged: bool, + selection_unchanged: bool, + undo_steps: usize, + undo_restored: bool, +} + +#[test] +fn automatic_center_recording_resolves_all_three_playback_selections() { + let _case = CASE.lock().unwrap_or_else(|e| e.into_inner()); + let recording = record_center(true); + let mut observed = vec![]; + for (label, only_a, key, expected) in [ + ("one object / artboard", true, false, [[180.0, 140.0, 220.0, 160.0], [180.0, 120.0, 260.0, 180.0]]), + ("two objects / B key", false, true, [[200.0, 140.0, 240.0, 160.0], [180.0, 120.0, 260.0, 180.0]]), + ("two objects / selection", false, false, [[120.0, 100.0, 160.0, 120.0], [100.0, 80.0, 180.0, 140.0]]), + ] { + let mut app = playback_app(&recording, only_a, key); + let selection = app.session.active().unwrap().selection.clone(); + let undo = app.session.active().unwrap().history.undo.len(); + let result = actions::play(&mut app, 0, 0); + let actual = [bounds(&app, recording.a), bounds(&app, recording.b)]; + let raw_unchanged = serde_json::to_value(&app.ui.action_sets[0].actions[0].steps).unwrap() == recording.raw_steps; + let selection_unchanged = app.session.active().unwrap().selection == selection; + let undo_steps = app.session.active().unwrap().history.undo.len().saturating_sub(undo); + let undo_restored = result.is_ok() + && app.run("edit.undo", json!({})).is_ok() + && close(bounds(&app, recording.a), [20.0, 40.0, 60.0, 60.0]) + && close(bounds(&app, recording.b), [180.0, 120.0, 260.0, 180.0]); + observed.push(Observation { label, result, actual, expected, raw_unchanged, selection_unchanged, undo_steps, undo_restored }); + } + // All three actual playbacks, including the legitimate B-key control, precede assertions. + println!("automatic Center raw steps: {}", recording.raw_steps); + println!("automatic Center playback observations: {observed:#?}"); + for o in observed { + assert!(o.result.is_ok(), "{}: expected automatic reference selection, got {:?}", o.label, o.result); + assert!(close(o.actual[0], o.expected[0]) && close(o.actual[1], o.expected[1]), "{}: {o:?}", o.label); + assert!(o.raw_unchanged, "{}: playback must not rewrite the stored recording", o.label); + assert!(o.selection_unchanged, "{}: selected IDs and key remain unchanged", o.label); + assert_eq!(o.undo_steps, 1, "{}: Accelerated Center is one undo step", o.label); + assert!(o.undo_restored, "{}: one Undo restores both original rectangles", o.label); + } +} + +#[test] +fn legacy_center_without_the_option_keeps_its_frozen_key_target() { + let _case = CASE.lock().unwrap_or_else(|e| e.into_inner()); + let recording = record_center(false); + assert!(recording.ui["action_sets"][0]["actions"][0].get("automaticAlignTo").is_none()); + let mut app = playback_app(&recording, true, false); + let error = actions::play(&mut app, 0, 0).unwrap_err(); + assert!(error.to_lowercase().contains("key"), "{error}"); + assert!(close(bounds(&app, recording.a), [20.0, 40.0, 60.0, 60.0])); + assert!(close(bounds(&app, recording.b), [180.0, 120.0, 260.0, 180.0])); + assert_eq!(serde_json::to_value(&app.ui.action_sets[0].actions[0].steps).unwrap(), recording.raw_steps); +} + +fn raw_steps(app: &VectorcraftApp) -> Value { + serde_json::to_value(&app.ui.action_sets[0].actions[0].steps).unwrap() +} + +fn automatic_flag(app: &VectorcraftApp) -> bool { + serde_json::to_value(&app.ui.action_sets[0].actions[0]).unwrap()["automaticAlignTo"].as_bool().unwrap_or(false) +} + +#[test] +fn automatic_align_options_toggle_restores_the_original_recorded_targets() { + let _case = CASE.lock().unwrap_or_else(|e| e.into_inner()); + let recording = record_center(true); + let mut app = playback_app(&recording, false, false); + app.run(actions::ACTION_OPTIONS, json!({"set": 0, "action": 0, "automaticAlignTo": false})).unwrap(); + assert!(!automatic_flag(&app)); + let error = actions::play(&mut app, 0, 0).unwrap_err(); + assert!(error.to_lowercase().contains("key"), "{error}"); + assert_eq!(raw_steps(&app), recording.raw_steps, "turning the option off does not replace recorded params"); + assert!(close(bounds(&app, recording.a), [20.0, 40.0, 60.0, 60.0])); + app.run(actions::ACTION_OPTIONS, json!({"set": 0, "action": 0, "automaticAlignTo": true})).unwrap(); + assert!(automatic_flag(&app)); + let copy = app.ui.action_sets[0].actions[0].copy(); + assert_eq!(serde_json::to_value(copy).unwrap()["automaticAlignTo"], true, "copying retains the per-action choice"); + actions::play(&mut app, 0, 0).unwrap(); + assert!(close(bounds(&app, recording.a), [120.0, 100.0, 160.0, 120.0])); + assert!(close(bounds(&app, recording.b), [100.0, 80.0, 180.0, 140.0])); + assert_eq!(raw_steps(&app), recording.raw_steps); +} + +#[test] +fn automatic_align_observes_selection_changed_by_an_earlier_accelerated_step() { + let _case = CASE.lock().unwrap_or_else(|e| e.into_inner()); + let recording = record_center(true); + let mut app = playback_app(&recording, false, true); + app.ui.action_sets[0].actions[0].steps.insert(0, ("select.set".into(), json!({"ids": [recording.a.0]}))); + let raw = raw_steps(&app); + let undo = app.session.active().unwrap().history.undo.len(); + actions::play(&mut app, 0, 0).unwrap(); + assert!(close(bounds(&app, recording.a), [180.0, 140.0, 220.0, 160.0]), "the new one-object selection uses the artboard, not the former key"); + assert!(close(bounds(&app, recording.b), [180.0, 120.0, 260.0, 180.0])); + assert_eq!(raw_steps(&app), raw); + assert_eq!(app.session.active().unwrap().history.undo.len(), undo + 1); + app.run("edit.undo", json!({})).unwrap(); + assert!(close(bounds(&app, recording.a), [20.0, 40.0, 60.0, 60.0])); +} + +#[test] +fn automatic_align_step_speed_and_stop_continue_share_the_compiled_choice() { + let _case = CASE.lock().unwrap_or_else(|e| e.into_inner()); + let recording = record_center(true); + let mut app = playback_app(&recording, true, false); + app.ui.action_sets[0].actions[0].steps.insert(1, (actions::STOP_STEP.into(), json!({"message": "Choose B as key", "allowContinue": true}))); + let raw = raw_steps(&app); + app.run(actions::PLAYBACK_OPTIONS, json!({"speed": "step"})).unwrap(); + actions::play(&mut app, 0, 0).unwrap(); + assert!(close(bounds(&app, recording.a), [180.0, 40.0, 220.0, 60.0]), "only horizontal Center ran before the Step wait"); + assert!(actions::playback_held(&app)); + actions::playback_drawn(&mut app); + actions::tick_playback(&mut app, 1.0); + assert!(actions::waiting_at_stop(&app)); + // B must differ from the artboard center so a stale artboard reference fails this check. + app.run("select.set", json!({"ids": [recording.b.0]})).unwrap(); + app.run("object.move", json!({"dx": 0, "dy": 40})).unwrap(); + app.run("select.set", json!({"ids": [recording.a.0, recording.b.0]})).unwrap(); + app.run("select.key", json!({"id": recording.b.0})).unwrap(); + app.run(actions::CONTINUE_PLAYBACK, json!({})).unwrap(); + assert!(app.ui.action_playing.is_none()); + assert!( + close(bounds(&app, recording.a), [180.0, 180.0, 220.0, 200.0]), + "continued vertical Center resolves B at y=190, not the artboard at y=150" + ); + assert!(close(bounds(&app, recording.b), [180.0, 160.0, 260.0, 220.0]), "the current key stays stationary during Continue"); + assert_eq!(raw_steps(&app), raw); +} + +// These are the actual host I/O callbacks used by public Save/Load Actions commands. +// The stored bytes are observable without writing user files or exposing private file helpers. +type ActionFiles = std::rc::Rc>>>; + +fn host_files(app: &mut VectorcraftApp) -> ActionFiles { + let files = ActionFiles::default(); + let writes = files.clone(); + app.services.write = Some(Box::new(move |path, bytes| { + writes.borrow_mut().insert(path.to_string(), bytes.to_vec()); + Ok(()) + })); + let reads = files.clone(); + app.services.read = Some(Box::new(move |path| reads.borrow().get(path).cloned().ok_or_else(|| format!("no saved action file: {path}")))); + files +} + +fn save_file(app: &mut VectorcraftApp, files: &ActionFiles, path: &str) -> Value { + app.run(actions::SAVE_SET, json!({"set": 0, "path": path})).unwrap(); + serde_json::from_slice(files.borrow().get(path).unwrap()).unwrap() +} + +fn load_only_file(app: &mut VectorcraftApp, path: &str) { + app.ui.action_sets.clear(); + let result = app.run(actions::LOAD_SET, json!({"path": path})).unwrap(); + assert_eq!(result["set"], 0); +} + +#[test] +fn automatic_align_files_preserve_enabled_and_raw_recorded_excluded_semantics() { + let _case = CASE.lock().unwrap_or_else(|e| e.into_inner()); + let recording = record_center(true); + let mut app = playback_app(&recording, false, false); + let files = host_files(&mut app); + let enabled = save_file(&mut app, &files, "enabled.vcactions"); + assert_eq!(enabled["version"], 7); + assert_eq!(enabled["actions"][0]["automaticAlignTo"], true); + load_only_file(&mut app, "enabled.vcactions"); + assert!(automatic_flag(&app), "public file loading retains the enabled choice"); + assert_eq!(raw_steps(&app), recording.raw_steps); + + // The destination stays default-false; its automatic meaning comes only from recorded raw steps. + app.run(actions::NEW_ACTION, json!({"set": 0, "name": "Recorded Automatic Center"})).unwrap(); + actions::play(&mut app, 0, 0).unwrap(); + app.run(actions::STOP_RECORDING, json!({})).unwrap(); + let destination = app.ui.action_sets[0].actions[1].clone(); + assert_ne!(serde_json::to_value(&destination).unwrap()["automaticAlignTo"], true); + assert_eq!(destination.steps.len(), 1); + assert_eq!(destination.steps[0].0, "command.batch"); + let nested = destination.steps[0].1["commands"].as_array().unwrap(); + assert_eq!(nested.len(), 2); + assert!(nested.iter().all(|s| s["command"] == "object.align" && s["params"]["to"] == "auto")); + let raw = serde_json::to_value(&destination.steps).unwrap(); + app.ui.action_sets = vec![ActionSet::new("Recorded Default-false", vec![destination])]; + let recorded = save_file(&mut app, &files, "recorded.vcactions"); + assert_eq!(recorded["version"], 7, "raw automatic batches require version 7 even when no action flag is true"); + assert_ne!(recorded["actions"][0]["automaticAlignTo"], true); + load_only_file(&mut app, "recorded.vcactions"); + assert!(!automatic_flag(&app)); + assert_eq!(raw_steps(&app), raw); + let imported = app.ui.action_sets[0].actions[0].clone(); + let mut fresh = playback_app(&recording, false, false); + fresh.ui.action_sets = vec![ActionSet::new("Imported", vec![imported])]; + actions::play(&mut fresh, 0, 0).unwrap(); + assert!(close(bounds(&fresh, recording.a), [120.0, 100.0, 160.0, 120.0])); + assert!(close(bounds(&fresh, recording.b), [100.0, 80.0, 180.0, 140.0])); + + app.ui.action_sets[0].actions[0].excluded_steps.insert(0); + let excluded = save_file(&mut app, &files, "excluded.vcactions"); + assert_eq!(excluded["version"], 7, "excluding a raw automatic batch does not make its stored semantics compatible with older readers"); + load_only_file(&mut app, "excluded.vcactions"); + assert!(!automatic_flag(&app)); + assert_eq!(raw_steps(&app), raw); + assert!(app.ui.action_sets[0].actions[0].excluded_steps.contains(&0)); + + // Nested raw batches may be stored/excluded even though command.batch cannot execute nested batches. + // The format requirement follows their retained command semantics, not an executable flattening. + let recorded_batch = app.ui.action_sets[0].actions[0].steps[0].1.clone(); + app.ui.action_sets[0].actions[0].steps[0].1 = json!({"commands": [{"command": "command.batch", "params": recorded_batch}]}); + let deeper = raw_steps(&app); + assert_eq!(save_file(&mut app, &files, "nested-excluded.vcactions")["version"], 7); + load_only_file(&mut app, "nested-excluded.vcactions"); + assert_eq!(raw_steps(&app), deeper); + assert!(app.ui.action_sets[0].actions[0].excluded_steps.contains(&0)); +} + +const LEGACY_V1: &str = r#"{ + "format": "vcactions", + "version": 1, + "name": "Legacy Align", + "actions": [ + { + "name": "Frozen Center", + "steps": [ + { + "command": "object.align", + "params": { + "horizontal": "center", + "to": "key" + } + } + ] + } + ] +}"#; + +const LEGACY_V6: &str = r#"{ + "format": "vcactions", + "version": 6, + "name": "Legacy View", + "actions": [ + { + "name": "Zoom", + "steps": [ + { + "command": "view.zoomIn", + "params": {} + } + ] + } + ] +}"#; + +#[test] +fn automatic_align_legacy_files_keep_their_old_bytes_and_versions() { + let _case = CASE.lock().unwrap_or_else(|e| e.into_inner()); + let mut app = VectorcraftApp::new(Session::new(), Default::default()); + let files = host_files(&mut app); + for (path, wire, version) in [("legacy-v1.vcactions", LEGACY_V1, 1), ("legacy-v6.vcactions", LEGACY_V6, 6)] { + files.borrow_mut().insert(path.into(), wire.as_bytes().to_vec()); + load_only_file(&mut app, path); + assert!(!automatic_flag(&app)); + let saved = save_file(&mut app, &files, "legacy-resaved.vcactions"); + assert_eq!(saved["version"], version); + assert_eq!(files.borrow().get("legacy-resaved.vcactions").unwrap(), wire.as_bytes(), "false-only legacy serialization is byte-equivalent"); + } + let future = LEGACY_V6.replace("\"version\": 6", "\"version\": 8"); + assert!(app.run(actions::LOAD_SET, json!({"data": future})).unwrap_err().contains("later version")); +} + +#[test] +fn automatic_align_ignores_an_artboard_the_step_stores() { + let _case = CASE.lock().unwrap_or_else(|e| e.into_inner()); + let mut app = VectorcraftApp::new(Session::new(), Default::default()); + app.run("file.new", json!({"width": 400, "height": 300, "artboards": 2, "profile": null})).unwrap(); + app.run("paint.setStroke", json!({"none": true})).unwrap(); + let a = NodeId(app.run("shape.rectangle", json!({"x": 20, "y": 40, "width": 40, "height": 20})).unwrap()["id"].as_u64().unwrap()); + app.run("select.set", json!({"ids": [a.0]})).unwrap(); + let center = json!({"horizontal": "center", "vertical": "center", "to": "artboard"}); + app.run("object.align", center.clone()).unwrap(); + let current = bounds(&app, a); + app.run("edit.undo", json!({})).unwrap(); + let mut stored = center; + stored["artboard"] = json!(1); + app.run("object.align", stored.clone()).unwrap(); + let second = bounds(&app, a); + app.run("edit.undo", json!({})).unwrap(); + assert!(!close(current, second), "the two artboards center the rectangle in different places"); + + let mut action = actions::Action::new("Center", vec![("object.align".into(), stored.clone())]); + action.automatic_align_to = true; + app.ui.action_sets = vec![ActionSet::new("Automatic Align", vec![action])]; + actions::play(&mut app, 0, 0).unwrap(); + assert!(close(bounds(&app, a), current), "automatic playback uses the current artboard, not the stored one"); + assert_eq!(app.ui.action_sets[0].actions[0].steps[0].1, stored, "the stored step keeps its artboard"); +} + +#[test] +fn automatic_align_inside_a_recorded_batch_run_needs_version_7() { + let _case = CASE.lock().unwrap_or_else(|e| e.into_inner()); + let mut app = VectorcraftApp::new(Session::new(), Default::default()); + let files = host_files(&mut app); + let align = json!({"command": "object.align", "params": {"horizontal": "center", "to": "auto"}}); + let batch = json!({"commands": [align], "label": "Center", "source": "datasets", "destination": "none"}); + let action = actions::Action::new("Batch Center", vec![("action.batch".into(), batch.clone())]); + app.ui.action_sets = vec![ActionSet::new("Recorded Batch", vec![action])]; + let saved = save_file(&mut app, &files, "batch.vcactions"); + assert_eq!(saved["version"], 7, "a Batch run's automatic Align step needs a reader that knows `to: \"auto\"`"); + assert_ne!(saved["actions"][0]["automaticAlignTo"], true); + load_only_file(&mut app, "batch.vcactions"); + assert_eq!(app.ui.action_sets[0].actions[0].steps[0].1, batch); +} diff --git a/docs/mcp.md b/docs/mcp.md index 5bc273289c..bba74e7bff 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -4133,18 +4133,21 @@ already walks Image Trace. Short agent entry points: `stepIndex` from 0, and `batchStep` is the command's place in a `command.batch` step), and `unknownCount`, how many there are; the status bar names the first and the count, with control characters replaced and long names cut at 80 characters. These are VectorCraft's own rules. An action set file (`.vcactions`) is JSON: - `{"format": "vcactions", "version": 1 to 6, "name", "actions": [{"name", "steps": [{"command", "params", "excluded"?}]}]}`, each step + `{"format": "vcactions", "version": 1 to 7, "name", "actions": [{"name", "steps": [{"command", "params", "excluded"?}], "automaticAlignTo"?}]}`, each step a command id and its params as `command.batch` takes them, or a stop: the command `action.stop` with `{message, allowContinue}`. A Select Object step is the command `select.byNote` with `{note, caseSensitive, wholeWord}`, and a Select Path step is the command `select.storedPath` with `{id, fingerprint}`. A View menu step is the id of a View menu command that the app runs itself (`view.outline`, `view.zoomIn`, `view.rotate` and the others `ui.action.insertMenuItem` lists) with the item's params. `excluded: true` preserves a step but omits it from playback; - an absent or false flag includes the step. Files with View menu steps use version 6, files with Select Path steps and + an absent or false flag includes the step. Files with an action whose `automaticAlignTo` is true, or with an + `object.align` step (excluded, or inside a `command.batch` or `action.batch` step, too) whose `to` is `"auto"`, use + version 7. Other + files with View menu steps use version 6, files with Select Path steps and no View menu step use version 5, files with Select Object steps and neither use version 4, files with stops and none of these use version 3, and files with excluded steps and none of these use version 2, so older builds refuse them instead of playing the excluded steps or failing at a stop, a Select Object step, a Select Path step or a View menu - step; other files use version 1, and version 1 to 5 files still load. A file with another `format` or a `version` other than - 1 to 6, a stop whose message is not text or whose `allowContinue` is not true or false, a Select Object step whose params `ui.action.insertSelectObject` would refuse, a View menu step whose params are not an object, a file larger than 8 MiB, one with more than 1,000 actions and one with an action of more than 10,000 steps are + step; other files use version 1, and version 1 to 6 files still load. A file with another `format` or a `version` other than + 1 to 7, a stop whose message is not text or whose `allowContinue` is not true or false, a Select Object step whose params `ui.action.insertSelectObject` would refuse, a View menu step whose params are not an object, a file larger than 8 MiB, one with more than 1,000 actions and one with an action of more than 10,000 steps are refused, and no set is added. So is a file whose set `ui.actionSet.save` would write larger than 8 MiB (a file with less white space, a set name that gets a number, or an `.aia` set), with the error `the action set would be larger than 8 MiB`. The Actions panel menu's Save Actions… and Load Actions… run these; Load Actions… is @@ -4175,18 +4178,26 @@ already walks Image Trace. Short agent entry points: exclusion that would give the set's action set file more than 8 MiB, counting the steps the recording in progress adds to the set; it is an error. A change that leaves the file as large or makes it smaller is never refused. The panel's checkmarks run this command; normal playback and Batch… skip excluded steps. -- Actions: `ui.action.new {set, name, key?, cmd?, shift?, color?}` adds an action named `name` (spaces +- Actions: `ui.action.new {set, name, key?, cmd?, shift?, color?, automaticAlignTo?}` adds an action named `name` (spaces trimmed) after the last action of set `set` (0 is the top set), starts recording into it and returns `{set, action}`; Stop Playing/Recording (`ui.action.stop`) ends the recording. `key` 1 to 15 is the function key F1 to F15 that plays the action (0 or null for none), with `cmd` (Ctrl, Command on macOS) and `shift`. `color` is its Button Mode color (`red`, `yellow`, `green`, `blue` or `violet`; null or `""` for none), the color of its button in Button Mode - (`ui.action.buttonMode`). Action function + (`ui.action.buttonMode`). `automaticAlignTo: true` makes playback run each of the action's `object.align` steps, + those in a recorded Batch run (`action.batch`) included, with `to: "auto"` (see [Align to Artboard](#align-to-artboard)): + the key object, key anchor or key guide, else the artboard for one whole selected object, else the selection. Playback also leaves out an `artboard` the step stores, so the step uses the + active artboard, as `object.align` without `artboard` does. A Batch run passes no active artboard to its steps, so + when an `object.align` step in a Batch run aligns to the artboard, it uses the artboard under the center of the + selection, or the first artboard when none is there. The stored steps keep the `to` they were recorded with, + and the action plays them as recorded again when the option is turned off. It is false when left out or null, and a value that is not + true, false or null is an error. These are VectorCraft's own rules. Action function keys take priority over command shortcuts and preserve the command's binding. On Windows F1, Ctrl+F4 and Ctrl+F6 cannot be used. While an action is recording, and for an index past the last set, an empty name, or a key or color that is not one of these, it is an error and nothing is added. So is an action that would give the set more than 1,000 actions (`the action set file holds more than 1,000 actions`) or a file larger than 8 MiB (`the action set would be larger than 8 MiB`), and then no recording starts. The panel's Create - New Action button and menu's New Action… open the `actionNew` dialog, whose Record runs this. + New Action button and menu's New Action… open the `actionNew` dialog, whose Record runs this; its Choose Align To at + playback checkbox sets `automaticAlignTo`. - Actions: `ui.action.record {set?, action?, after?}` starts recording a new action in the chosen set, or the current set when `set` is left out, and returns `{set, name}`. With no sets, it creates Set 1. The action gets the next available `Action N` name in that set. With `action`, it records into the action at `action` in set `set` instead @@ -4207,11 +4218,12 @@ already walks Image Trace. Short agent entry points: `ui.action.stop` keeps the steps that fit. A stop that playback reaches then is not recorded, and the status bar shows the reason. `ui.action.stop` leaves out any recorded steps still past either limit and shows which one in the status bar. -- Actions: `ui.action.options {set, action, name?, key?, cmd?, shift?, color?}` changes the action at +- Actions: `ui.action.options {set, action, name?, key?, cmd?, shift?, color?, automaticAlignTo?}` changes the action at `action` in set `set` and keeps its steps: `name` renames it, `key` with `cmd` and `shift` sets its function key, - and `color` its Button Mode color, as `ui.action.new` takes them; a param left out keeps what the action has, and - `cmd` or `shift` alone changes that modifier of its key. It - returns `{name, key, color}`. The panel menu's Action Options… runs this for the selected action. A function key + `color` its Button Mode color and `automaticAlignTo` how its Align steps play, as `ui.action.new` takes them; a param + left out (or a null `automaticAlignTo`) keeps what the action has, and `cmd` or `shift` alone changes that modifier + of its key. It returns `{name, key, color, automaticAlignTo}`. The panel menu's Action Options… runs this for the + selected action, and its dialog has the same checkbox as New Action…. A function key plays its action from the keyboard; like command shortcuts, it does nothing while a dialog, the command palette or a text field has the keyboard, or while a tool is busy. Editing command shortcuts (`shortcuts.set`, Keyboard Shortcuts), loading preferences and `ui.actionSet.load` preserve action function keys. When several actions have the same key, the first in panel order @@ -4279,7 +4291,8 @@ already walks Image Trace. Short agent entry points: toggle, an Actions command, a Perspective Grid preset of the preferences or a recent-font, saved-selection or saved-view slot. Disabled items are listed, and playback checks the step when it runs. An Object › Align item's step keeps the `to` its click sends at insertion (`key` while the selection has a key object or key guide, `artboard` for one selected object or with Align to Artboard, else `selection`), so a later Align To choice does not change it, and a step that - aligns to the key object fails in playback when the selection has no key then. With anchor points selected the click + aligns to the key object fails in playback when the selection has no key then. In an action with `automaticAlignTo` + on (`ui.action.new`), playback sends `to: "auto"` for every `object.align` step instead. With anchor points selected the click sends no `to`, and neither does the step. These are VectorCraft's own rules. A View menu step plays as `ui.action.play` describes. With `set` and `action`, the step goes into that action, after step `step`, else after its last step, becomes the panel's selected step, and the @@ -7072,6 +7085,10 @@ below 3 or above 1000 counts as 3 or 1000, and a fractional or negative `sides` ## Align to Artboard +`object.align {to: "auto"}` chooses the target each time it runs: the key object, key anchor or key guide when the +selection has one, else the artboard when exactly one object is selected and no anchor points are, else the selection. It then aligns +as that `to` value does, and it changes neither the selection nor the key. These are VectorCraft's own rules. + `object.align {to: "artboard", artboard?}` aligns the selected objects to artboard `artboard` (a 0-based index). Without `artboard`, or with an index the document doesn't have, it aligns them to the artboard under the center of the selection, or to the first artboard when no artboard is under the center. With `to: "selection"` or `"key"`, diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 6c61e9f025..bb21ee9a5a 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -909,6 +909,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - Actions panel menu: Load Actions… reads an `.aia` file's Set Selection step, which selects objects by the note typed in its dialog ([the help page](https://helpx.adobe.com/illustrator/desktop/automate-visualize-data/automate-actions/insert-non-recordable-tasks-into-actions.html)), as a Select Object step with its note, Case Sensitive and Whole Word (`ui.actionSet.load`; `actionSet.read` now lists each step's recorded values with their keys and types). VectorCraft's own rules: the step is found by its internal name whatever its label, and comes in only when it has exactly the note (UTF-8, 1 to 1,024 bytes once trimmed) and the two options (each 0 or 1); any other Set Selection step is left out and counted, with no option filled in. Tests `panels::actions::tests::{load_actions_reads_set_selection_steps_as_select_object, set_selection_steps_with_bad_values_are_left_out}`, `tests::actionset::{recorded_values_come_back_with_their_keys_and_types, recorded_values_past_the_cap_are_counted_but_not_kept}`. - Actions panel: the panel menu's Action Options… renames the selected action and keeps its steps ([Actions panel overview](https://helpx.adobe.com/illustrator/desktop/automate-visualize-data/automate-actions/actions-panel-overview.html): the menu item opens a dialog that renames the action or gives it a function key and color; `ui.action.options`). It also sets the action's function key and color. - Actions panel: Create New Action (bottom bar) and the panel menu's New Action… ask for the new action's name, set, function key and color, and Record adds the action and starts recording into it ([Create new actions](https://helpx.adobe.com/illustrator/desktop/automate-visualize-data/automate-actions/record-actions.html): the New Action dialog takes the action's name and the set it goes in; `ui.action.new`, `ui.action.play`). The function key (F1 to F15, with Ctrl or Command and Shift) plays the action. An action's function key plays the action even when a command has the same shortcut, and the command keeps it. VectorCraft's own rules, which the page does not cover: when several actions have the same key the first in panel order plays; a copied action has no key; New Action does not open while an action is recording. The color is the color of the action's button in Button Mode. + - Actions panel: New Action… and Action Options… have Choose Align To at playback, off by default. With it on, each Align step of the action aligns to the key object, key anchor or key guide when the selection has one, else to the artboard when one whole object is selected, else to the selection; the recorded steps are kept as they were, and Save Actions… and Load Actions… keep the option (#6972; `ui.action.new`, `ui.action.options`, `object.align` with `to: "auto"`). These are VectorCraft's own rules. - Actions panel: the panel menu's Button Mode shows the actions as buttons with their names in their Action Options colors, without sets or individual commands; a click on a button plays its action without its excluded steps, and choosing Button Mode again returns to the list ([the help page](https://web.archive.org/web/20220911143322/https://helpx.adobe.com/pdf/cs6/illustrator_reference.pdf#page=467) and [the next page](https://web.archive.org/web/20220911143322/https://helpx.adobe.com/pdf/cs6/illustrator_reference.pdf#page=468); [the help page](https://helpx.adobe.com/illustrator/desktop/automate-visualize-data/automate-actions/exclude-commands-from-actions.html) says commands cannot be excluded in Button Mode; `ui.action.buttonMode`, `ui.action.playAt`). VectorCraft's own rules, which the pages do not cover: the menu item shows a check mark while Button Mode is on; every set's actions show, in set order and then action order; an action without a color is an ordinary button; function keys still play their actions; the bottom bar shows only Stop Playing/Recording while an action plays or records, and Play Current Selection while one waits at a stop; Button Mode cannot be turned on while an action records; and the mode is kept with the UI preferences. - Actions panel: with an action selected, Begin Recording adds the commands recorded to that action, after its selected step or at its end, and a step dragged within its action or to another action goes where a highlighted line shows when the button is released ([the help page](https://helpx.adobe.com/illustrator/desktop/automate-visualize-data/automate-actions/add-commands-to-actions.html); `ui.action.record`, `ui.action.moveStep`). VectorCraft's own rules, which the page does not cover: with no action selected Begin Recording adds a new action; a step can go into an empty action or an action in another set; a release off the actions' rows leaves the step where it was; a moved step keeps whether it is excluded; Undo does not move it back. - Actions panel (record/playback, persisted), generic parameter dialogs for every "…" command. @@ -918,7 +919,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - Actions panel: the panel menu's Playback Options… sets how actions play: Accelerated (the default) plays every step at once, Step by Step plays one step at a time with the canvas drawn after each, and Pause For waits the given number of seconds between steps ([Specify playback speed](https://helpx.adobe.com/illustrator/desktop/automate-visualize-data/automate-actions/specify-playback-speed.html); `ui.action.playbackOptions`). VectorCraft's own rules, which the page does not cover: the pause is a whole number of seconds from 1 to 60, the setting is kept with the UI preferences, a paced playback ends at Stop Playing/Recording or when a step comes due while another document is active, each step of a paced playback is its own undo step, and Batch… plays at full speed. - Actions panel: the panel menu's Insert Stop… opens Record Stop, with a Message box and Allow Continue, and adds a stop to the recording in progress, after the selected command, or at the end of the selected action ([Insert stops in actions](https://helpx.adobe.com/illustrator/desktop/automate-visualize-data/automate-actions/insert-stops-in-actions.html); `ui.action.insertStop`). A playing action waits at the stop and shows the message so the user can do a manual task, and Play Current Selection plays the rest ([Illustrator CS5 help](https://help.adobe.com/archive/en_US/illustrator/cs5/illustrator_cs5_help.pdf#page=459); `ui.action.continue`). With Allow Continue, the message box also has Continue. VectorCraft's own rules, which the pages do not cover: an empty message still waits, Stop Playing/Recording ends the playback and keeps the steps already played, the rest plays on the document active then, a stop waits at every playback speed, at Accelerated the steps between two stops are one undo step, Batch… refuses an action with an included stop, and Delete Selection on a selected step deletes that step, a stop or a command, without asking (`ui.action.deleteStep`). - Actions panel: the panel menu's Insert Menu Item… adds a menu command to the recording in progress, after the selected step, or at the end of the selected action, without running it, and playback runs it as the menu does ([Insert non-recordable tasks into actions](https://helpx.adobe.com/illustrator/desktop/automate-visualize-data/automate-actions/insert-non-recordable-tasks-into-actions.html); `ui.action.insertMenuItem`). The dialog's Find box picks the one item that matches the words typed, and a click on a listed item picks it. VectorCraft's own rules, which the page does not cover: items that open a dialog, Image Trace's Make and Make and Expand, Pattern's Make and Edit Pattern, and the File, Window and Help menu items are not listed, and an action holds at most 10,000 steps and its set file at most 8 MiB, for stops too. - - Actions panel: Insert Menu Item… also lists the Object › Align items and the View menu commands that act on the window rather than the document (Outline, Pixel Preview, Trim View, Presentation Mode, Screen Mode, zoom, fit, Rotate View, and the show, hide and snap items), which the help page names among the commands that cannot be recorded ([Insert non-recordable tasks into actions](https://helpx.adobe.com/illustrator/desktop/automate-visualize-data/automate-actions/insert-non-recordable-tasks-into-actions.html); [Align and distribute objects](https://helpx.adobe.com/illustrator/desktop/manage-objects/arrange-objects/align-and-distribute-objects.html); `ui.action.insertMenuItem`, `ui.action.play`). VectorCraft's own rules, which the pages do not cover: an Align step keeps the Align To choice of its insertion, and one that aligns to the key object stops the playback when there is no key; a View menu step plays in its place at every speed and adds no undo step, so at Accelerated the steps on each side of it are one undo step each; Batch… refuses an action with one; and a set file with one is version 6. Tests `panels::actions::tests::{an_inserted_view_item_plays_in_its_place_at_accelerated, an_inserted_view_item_plays_step_by_step_and_with_pauses, an_inserted_view_item_plays_up_to_a_stop, a_view_step_played_while_recording_is_recorded, a_saved_view_step_survives_as_version_6, an_inserted_align_item_keeps_the_align_to_of_its_insertion, an_align_step_to_the_key_object_fails_without_a_key}`. + - Actions panel: Insert Menu Item… also lists the Object › Align items and the View menu commands that act on the window rather than the document (Outline, Pixel Preview, Trim View, Presentation Mode, Screen Mode, zoom, fit, Rotate View, and the show, hide and snap items), which the help page names among the commands that cannot be recorded ([Insert non-recordable tasks into actions](https://helpx.adobe.com/illustrator/desktop/automate-visualize-data/automate-actions/insert-non-recordable-tasks-into-actions.html); [Align and distribute objects](https://helpx.adobe.com/illustrator/desktop/manage-objects/arrange-objects/align-and-distribute-objects.html); `ui.action.insertMenuItem`, `ui.action.play`). VectorCraft's own rules, which the pages do not cover: an Align step keeps the Align To choice of its insertion, and one that aligns to the key object stops the playback when there is no key, unless the action has Choose Align To at playback on; a View menu step plays in its place at every speed and adds no undo step, so at Accelerated the steps on each side of it are one undo step each; Batch… refuses an action with one; and a set file with one is version 6, or version 7 when the set also uses Choose Align To at playback or holds an Align step with `to: "auto"`. Tests `panels::actions::tests::{an_inserted_view_item_plays_in_its_place_at_accelerated, an_inserted_view_item_plays_step_by_step_and_with_pauses, an_inserted_view_item_plays_up_to_a_stop, a_view_step_played_while_recording_is_recorded, a_saved_view_step_survives_as_version_6, an_inserted_align_item_keeps_the_align_to_of_its_insertion, an_align_step_to_the_key_object_fails_without_a_key}`. - Actions panel: the error of a played step that fails names the step by its place in the expanded action, 1 for the first step, counting excluded steps and stops, at every playback speed and after a stop (`ui.action.play`, `ui.action.continue`). A failing step of a recorded batch is named by the batch's place and its own command. The numbering is VectorCraft's own rule. Tests `panels::actions::tests::{an_error_after_a_view_item_names_the_step_in_the_action, a_failing_view_item_names_the_step_in_the_action, an_error_counts_excluded_steps, an_error_in_a_recorded_batch_names_the_batch_step, an_error_of_the_whole_batch_names_no_step, a_paced_error_names_the_step_in_the_action, an_error_after_a_stop_names_the_step_in_the_action}`. - Actions panel: with a path selected, the panel menu's Insert Select Path adds a step that selects that path to the recording in progress, after the selected step, or at the end of the selected action, without changing the selection ([Insert non-recordable tasks into actions](https://helpx.adobe.com/illustrator/desktop/automate-visualize-data/automate-actions/insert-non-recordable-tasks-into-actions.html); `ui.action.insertSelectPath`, `select.storedPath`). VectorCraft's own rules, which the page does not cover: the selection must be one whole path or compound path that can be selected, the step stores the path's id and a fingerprint of its anchors, and playback selects the path only while it is still there unchanged and can be selected, else the step is an error and the selection stays; the row reads Select Path, and a set file with the step is version 5. - Actions panel: the panel menu's Select Object… opens Set Selection, where the note typed names the objects to select, and adds a step to the recording in progress, after the selected step, or at the end of the selected action; playback selects the objects whose Attributes note matches it, and the steps after it act on them ([Insert non-recordable tasks into actions](https://helpx.adobe.com/illustrator/desktop/automate-visualize-data/automate-actions/insert-non-recordable-tasks-into-actions.html); `ui.action.insertSelectObject`, `select.byNote`). VectorCraft's own rules, which the page does not cover: the note matches anywhere and in any letter case unless Case Sensitive or Whole Word is checked, hidden and locked objects are left out, the objects found replace the selection, a step that finds none stops the playback with an error, and the note is at most 1,024 bytes. Action sets with the step save as version 4.