From 6742d277e960cd257de6ef93e13476ab7966ebdd Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Fri, 13 Nov 2026 09:35:28 -0800 Subject: [PATCH] Tools: Ctrl+` chooses the selection tool chosen last Select Last Selection Tool (tool.selectLastSelection, {}) chooses the one of Selection, Direct Selection and Group Selection chosen last, or the Selection tool before any of them is chosen. Magic Wand, Lasso and other tools do not change which one it chooses, and running it with that tool active keeps it. It returns {tool} and adds no undo step. The help page lists the shortcut: https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html - Default Ctrl+` (Cmd+~) on Windows and Linux. macOS keeps Command+` for switching between an app's windows, so the command has no default there; Edit > Keyboard Shortcuts can assign one. The keymap, the shortcut editor and engine.commands use the platform's default. - The headless backend and vectorcraft-cli run accept it as a host command. - In the app, tool.select and tool.selectLastSelection return the error when the tool switch fails. The app's tool.select reported success before and showed the error only in the status bar. - A row for the label in every catalog; docs/mcp.md and the progress line in docs/target-app-parity.md. --- crates/engine/src/tooling.rs | 6 +++++ crates/mcp/src/headless.rs | 15 ++++++++++++ crates/mcp/src/tests.rs | 24 +++++++++++++++++++ crates/mcp/src/ui_catalog.rs | 6 +++++ crates/ui-egui/src/app/commands.rs | 23 +++++++++++++----- crates/ui-egui/src/canvas/tests.rs | 31 +++++++++++++++++++++++++ crates/ui-egui/src/control.rs | 1 + crates/ui-egui/src/control/tests.rs | 16 +++++++++++++ crates/ui-egui/src/i18n/bg.tsv | 1 + crates/ui-egui/src/i18n/bs.tsv | 1 + crates/ui-egui/src/i18n/ca.tsv | 1 + crates/ui-egui/src/i18n/cs.tsv | 1 + crates/ui-egui/src/i18n/da.tsv | 1 + crates/ui-egui/src/i18n/de.tsv | 1 + crates/ui-egui/src/i18n/el.tsv | 1 + crates/ui-egui/src/i18n/es.tsv | 1 + crates/ui-egui/src/i18n/fi.tsv | 1 + crates/ui-egui/src/i18n/fr.tsv | 1 + crates/ui-egui/src/i18n/hi.tsv | 1 + crates/ui-egui/src/i18n/hu.tsv | 1 + crates/ui-egui/src/i18n/id.tsv | 1 + crates/ui-egui/src/i18n/it.tsv | 1 + crates/ui-egui/src/i18n/ja.tsv | 1 + crates/ui-egui/src/i18n/ka.tsv | 1 + crates/ui-egui/src/i18n/ko.tsv | 1 + crates/ui-egui/src/i18n/nl.tsv | 1 + crates/ui-egui/src/i18n/pl.tsv | 1 + crates/ui-egui/src/i18n/pt-br.tsv | 1 + crates/ui-egui/src/i18n/ru.tsv | 1 + crates/ui-egui/src/i18n/sv.tsv | 1 + crates/ui-egui/src/i18n/tr.tsv | 1 + crates/ui-egui/src/i18n/uk.tsv | 1 + crates/ui-egui/src/i18n/vi.tsv | 1 + crates/ui-egui/src/i18n/zh-hans.tsv | 1 + crates/ui-egui/src/i18n/zh-hant.tsv | 1 + crates/ui-egui/src/keymap.rs | 22 +++++++++++++++++- crates/ui-egui/src/menus/run.rs | 10 ++++---- crates/ui-egui/src/menus/ui_commands.rs | 6 +++++ crates/ui-egui/src/shortcut_editor.rs | 29 ++++++++++++++++++----- crates/ui-egui/src/shortcuts/tests.rs | 24 +++++++++++++++++++ docs/mcp.md | 12 +++++++++- docs/target-app-parity.md | 1 + 42 files changed, 235 insertions(+), 18 deletions(-) diff --git a/crates/engine/src/tooling.rs b/crates/engine/src/tooling.rs index 0452251a09..fe6b4523e7 100644 --- a/crates/engine/src/tooling.rs +++ b/crates/engine/src/tooling.rs @@ -120,6 +120,12 @@ impl Session { self.tool.id() } + /// The selection tool chosen last (Selection, Direct Selection or Group Selection), which + /// `tool.selectLastSelection` chooses: the Selection tool until one is chosen. + pub fn last_selection_tool(&self) -> &'static str { + self.last_selection_tool.unwrap_or("selection") + } + /// How many times switching or closing documents, or replacing the active one (File › Revert), /// has started the tool afresh, also inside a `command.batch` or `action.batch`. A frontend /// compares it before and after a command. diff --git a/crates/mcp/src/headless.rs b/crates/mcp/src/headless.rs index 69c7b5ba0e..6b34a82edc 100644 --- a/crates/mcp/src/headless.rs +++ b/crates/mcp/src/headless.rs @@ -45,6 +45,11 @@ const HOST_COMMANDS: &[(&str, &str, &str)] = &[ "{folder?, zip?, artboards? | range? | fullDocument? | assets?, includeBleed?, includeArtboardFill?, subfolders?, preset?, formats?, settings?, prefix?} = document.exportForScreens (no folder → the files, or one zip, as dataBase64)", ), ("tool.select", "Select Tool", "{tool} e.g. selection, directSelection, pen, rectangle, ellipse, polygon, star, lineSegment"), + ( + "tool.selectLastSelection", + "Select Last Selection Tool", + "{} choose the selection tool chosen last (Selection, Direct Selection or Group Selection; none yet: the Selection tool) → {tool}", + ), ( "tool.setOption", "Tool Option", @@ -164,6 +169,7 @@ impl Headless { "file.export" => self.export(params), "file.exportForScreens" => self.session.execute("document.exportForScreens", params).map_err(|e| e.to_string()), "tool.select" => self.select_tool(params), + "tool.selectLastSelection" => self.select_last_selection_tool(), "tool.setOption" => self.session.set_tool_option_cmd(params), _ => self.session.execute(id, params).map_err(|e| e.to_string()), } @@ -207,6 +213,15 @@ impl Headless { Ok(json!({"tool": self.session.tool_id()})) } + /// `tool.selectLastSelection`: the selection tool chosen last, kept when it is already active. + fn select_last_selection_tool(&mut self) -> Result { + let id = self.session.last_selection_tool(); + if self.session.tool_id() != id { + self.session.select_tool(id, self.view).map_err(|e| e.to_string())?; + } + Ok(json!({"tool": self.session.tool_id()})) + } + fn apply_ui_requests(&mut self, reqs: Vec, out: &mut Vec) -> Result<(), String> { for r in reqs { match r { diff --git a/crates/mcp/src/tests.rs b/crates/mcp/src/tests.rs index 6529cf175d..987df83c3f 100644 --- a/crates/mcp/src/tests.rs +++ b/crates/mcp/src/tests.rs @@ -1797,6 +1797,30 @@ fn e_during_a_marquee_gesture_selects_only_the_objects_inside() { assert_eq!(serde_json::from_str::(&text_of(&r)).unwrap()["handledBy"], "tool.select", "{r}"); } +/// `run_command tool.selectLastSelection` headless: the Selection tool before any selection tool +/// is chosen, then the selection tool chosen last; Magic Wand doesn't count. `list_commands` +/// lists it as a command the headless backend runs. +#[test] +fn select_last_selection_tool_runs_headless() { + let mut s = server(); + let mut id = 0; + let mut run = |s: &mut Server, command: &str, params: Value| { + id += 1; + let r = call(s, id, "run_command", json!({"command": command, "params": params})); + assert_eq!(r["isError"], false, "{command}: {r}"); + serde_json::from_str::(&text_of(&r)).unwrap() + }; + run(&mut s, "tool.select", json!({"tool": "pen"})); + assert_eq!(run(&mut s, "tool.selectLastSelection", json!({})), json!({"tool": "selection"})); + run(&mut s, "tool.select", json!({"tool": "groupSelection"})); + run(&mut s, "tool.select", json!({"tool": "magicWand"})); + assert_eq!(run(&mut s, "tool.selectLastSelection", json!({})), json!({"tool": "groupSelection"})); + let r = call(&mut s, 99, "list_commands", json!({"filter": "selectLastSelection"})); + let v: Value = serde_json::from_str(&text_of(&r)).unwrap(); + let listed = v["commands"].as_array().unwrap().iter().find(|c| c["id"] == "tool.selectLastSelection").cloned().unwrap_or_default(); + assert_eq!((listed["host"].clone(), listed["label"].clone()), (json!(true), json!("Select Last Selection Tool")), "{v}"); +} + /// `press_key {key: "c"}` and `{key: "f"}` while an arc is being dragged go to the Arc tool, and /// the release draws one arc. With nothing dragged, C is a shortcut again. #[test] diff --git a/crates/mcp/src/ui_catalog.rs b/crates/mcp/src/ui_catalog.rs index 3e80e0a2dd..59c1fece68 100644 --- a/crates/mcp/src/ui_catalog.rs +++ b/crates/mcp/src/ui_catalog.rs @@ -771,6 +771,12 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[ "{} make the open document before the current one in tab order the current one, as a click on its tab does (before the first document it goes to the last, and from the Home screen to the last); each view window.newWindow opened is a step of its own; returns {index}, with `view` for a document with more than one view", ), ("tool.select", "Select Tool", "", "{tool: id} (see tools)"), + ( + "tool.selectLastSelection", + "Select Last Selection Tool", + "Cmd+~", + "{} choose the selection tool chosen last (Selection, Direct Selection or Group Selection; none yet: the Selection tool), keeping the active tool when it is that tool; choosing Magic Wand, Lasso or any other tool does not change which one it chooses → {tool}. Default shortcut Ctrl+` on Windows and Linux, none on macOS, where Cmd+` switches windows", + ), ( "tool.setOption", "Tool Option", diff --git a/crates/ui-egui/src/app/commands.rs b/crates/ui-egui/src/app/commands.rs index 1d2493385e..479c4df359 100644 --- a/crates/ui-egui/src/app/commands.rs +++ b/crates/ui-egui/src/app/commands.rs @@ -411,31 +411,41 @@ impl VectorcraftApp { /// Select a tool (also used by the toolbar and shortcuts). pub fn select_tool(&mut self, id: &str) { + // A failure shows in the status bar. + let _ = self.try_select_tool(id); + } + + /// [`Self::select_tool`], returning the error it shows in the status bar when the switch fails. + pub(crate) fn try_select_tool(&mut self, id: &str) -> Result<(), String> { // The tip of a pen whose eraser end selected the Eraser doesn't undo this choice, and // neither does letting go of a held tool shortcut. self.pen_end.forget_tool(); self.held_tool.clear(); - self.activate_tool(id, true); + let switched = self.activate_tool(id, true); let now = self.session.tool_id(); if crate::touch::is_drawing_tool(now) { self.ui.touch_drawing_tool = Some(now.to_string()); } + switched } /// Go back to tool `id` after a tool that stood in for it (the pen's eraser end, [`stylus`]): /// a perspective grid hidden meanwhile stays hidden. pub(crate) fn return_to_tool(&mut self, id: &str) { - self.activate_tool(id, false); + // A failure shows in the status bar. + let _ = self.activate_tool(id, false); } /// Make tool `id` active: chosen afresh (`fresh`, [`vectorcraft_engine::Session::select_tool`]), - /// or back from a tool that stood in for it ([`vectorcraft_engine::Session::switch_tool`]). - fn activate_tool(&mut self, id: &str, fresh: bool) { + /// or back from a tool that stood in for it ([`vectorcraft_engine::Session::switch_tool`]). A + /// failure is shown in the status bar and returned. + fn activate_tool(&mut self, id: &str, fresh: bool) -> Result<(), String> { let v = self.view_info(); let before = self.session.tool_id(); let switched = if fresh { self.session.select_tool(id, v) } else { self.session.switch_tool(id, v) }; - if let Err(e) = switched { - self.ui.status = e.to_string(); + let switched = switched.map_err(|e| e.to_string()); + if let Err(e) = &switched { + self.ui.status.clone_from(e); } if before != self.session.tool_id() { // A control gesture cannot resume after another tool has owned the pointer. @@ -455,6 +465,7 @@ impl VectorcraftApp { } toolbar::remember(self, id); self.ui.flyout = None; + switched } /// Show a transient status message. diff --git a/crates/ui-egui/src/canvas/tests.rs b/crates/ui-egui/src/canvas/tests.rs index 6bf8a6fa97..089e597ee5 100644 --- a/crates/ui-egui/src/canvas/tests.rs +++ b/crates/ui-egui/src/canvas/tests.rs @@ -1051,6 +1051,37 @@ fn switch_selection_and_drawing_modes_command() { } } +/// Select Last Selection Tool: the Selection tool before any selection tool is chosen, then the +/// one of Selection, Direct Selection and Group Selection chosen last; Magic Wand and Lasso don't +/// count. Running it again keeps that tool, and it changes no art, selection or undo history. +#[test] +fn select_last_selection_tool_command() { + let mut app = VectorcraftApp::new(Session::new(), Default::default()); + app.session.execute("file.new", &json!({"width": 400, "height": 300})).unwrap(); + let id = app.session.execute("shape.rectangle", &json!({"x": 10, "y": 10, "width": 50, "height": 40})).unwrap()["id"].clone(); + app.session.execute("select.set", &json!({"ids": [id]})).unwrap(); + let last = |app: &mut VectorcraftApp| app.run("tool.selectLastSelection", json!({})).unwrap(); + let state = |app: &VectorcraftApp| { + let st = app.session.active().unwrap(); + (st.doc.clone(), st.selection.clone(), st.history.undo.len()) + }; + app.select_tool("pen"); + let before = state(&app); + assert_eq!((last(&mut app), app.session.tool_id()), (json!({"tool": "selection"}), "selection"), "none chosen yet: Selection"); + for id in ["directSelection", "groupSelection", "selection"] { + app.select_tool(id); + app.select_tool("pen"); + assert_eq!(last(&mut app), json!({"tool": id}), "{id}"); + } + app.select_tool("directSelection"); + for other in ["magicWand", "lasso", "rectangle", "hand"] { + app.select_tool(other); + } + assert_eq!(last(&mut app), json!({"tool": "directSelection"}), "Magic Wand and Lasso are not remembered"); + assert_eq!(last(&mut app), json!({"tool": "directSelection"}), "again: the same tool, no cycling"); + assert!(state(&app) == before, "no art, selection or undo step changes"); +} + /// The Artboard tool's label holds the artboard's name (never translated); the tools' own /// labels are interface text. #[test] diff --git a/crates/ui-egui/src/control.rs b/crates/ui-egui/src/control.rs index 89ab7e37b4..ca1d8baea1 100644 --- a/crates/ui-egui/src/control.rs +++ b/crates/ui-egui/src/control.rs @@ -239,6 +239,7 @@ fn wrap(r: Result) -> Outcome { pub fn all_commands(app: &VectorcraftApp) -> Value { let mut v: Vec = app.session.commands().into_iter().map(|c| serde_json::to_value(c).unwrap_or_default()).collect(); for (id, label, sc, params) in crate::menus::UI_COMMANDS { + let sc = crate::shortcut_editor::ui_command_default(id, sc, crate::keymap::platform()); v.push(json!({"id": id, "label": label, "shortcut": sc, "params": params, "enabled": crate::menus::enabled(app, id), "ui": true})); } Value::Array(v) diff --git a/crates/ui-egui/src/control/tests.rs b/crates/ui-egui/src/control/tests.rs index ac8fbfa3eb..08d6f9539c 100644 --- a/crates/ui-egui/src/control/tests.rs +++ b/crates/ui-egui/src/control/tests.rs @@ -1273,3 +1273,19 @@ fn dialog_set_refuses_a_field_the_dialog_does_not_have() { app.ui.dialog = None; assert_eq!(input_request(&mut app, "ui.dialog.set", json!({"field": "name", "value": "A"}))["error"], "no dialog open"); } + +/// `engine.commands` lists each UI command's default shortcut on this platform: Select Last +/// Selection Tool shows Ctrl+` (`Cmd+~`) on Windows and Linux and none on macOS. +#[test] +fn the_command_list_shows_this_platforms_default_shortcut() { + let mut app = VectorcraftApp::new(Session::new(), Services::default()); + let r = input_request(&mut app, "engine.commands", json!({})); + let row = r["result"].as_array().unwrap().iter().find(|c| c["id"] == "tool.selectLastSelection").cloned(); + let row = row.unwrap_or_else(|| panic!("listed: {r}")); + assert_eq!(row["shortcut"], if crate::keymap::platform().is_mac() { "" } else { "Cmd+~" }, "{row}"); + for p in [craft_keymap::Platform::Windows, craft_keymap::Platform::Linux] { + assert_eq!(crate::shortcut_editor::ui_command_default("tool.selectLastSelection", "Cmd+~", p), "Cmd+~", "{p:?}"); + } + assert_eq!(crate::shortcut_editor::ui_command_default("tool.selectLastSelection", "Cmd+~", craft_keymap::Platform::Mac), ""); + assert_eq!(crate::shortcut_editor::ui_command_default("view.zoomIn", "Cmd+=", craft_keymap::Platform::Mac), "Cmd+="); +} diff --git a/crates/ui-egui/src/i18n/bg.tsv b/crates/ui-egui/src/i18n/bg.tsv index 708ffe9db6..552589dbf6 100644 --- a/crates/ui-egui/src/i18n/bg.tsv +++ b/crates/ui-egui/src/i18n/bg.tsv @@ -1019,6 +1019,7 @@ font-technology Variable Променливи Enable text access for screen readers Разрешаване на достъп до текст за екранни четци Enable Touch Gestures Разрешаване на докосващи жестове Switch Selection and Drawing Modes Превключване между режим на селекция и рисуване + Select Last Selection Tool Избор на последния инструмент за селекция Enable Touch Workspace Разрешаване на работно пространство за докосване Encoding Кодиране Encoding: Кодиране: diff --git a/crates/ui-egui/src/i18n/bs.tsv b/crates/ui-egui/src/i18n/bs.tsv index 8f5ea73487..6b9a238354 100644 --- a/crates/ui-egui/src/i18n/bs.tsv +++ b/crates/ui-egui/src/i18n/bs.tsv @@ -3749,6 +3749,7 @@ theme Appearance Izgled Enable Rubber Band for Omogući gumenu traku za Enable Touch Gestures Omogući pokrete dodirom Switch Selection and Drawing Modes Prebaci između načina odabira i crtanja + Select Last Selection Tool Odaberi posljednji alat za odabir Enable Touch Workspace Omogući radni prostor za dodir English: UK Engleski: UK Every (minutes) Svakih (minuta) diff --git a/crates/ui-egui/src/i18n/ca.tsv b/crates/ui-egui/src/i18n/ca.tsv index 5516c9662f..cb3b052504 100644 --- a/crates/ui-egui/src/i18n/ca.tsv +++ b/crates/ui-egui/src/i18n/ca.tsv @@ -1486,6 +1486,7 @@ antiAlias Sharp Nítid Enable text access for screen readers Activa l’accés al text per als lectors de pantalla Enable Touch Gestures Activa els gestos tàctils Switch Selection and Drawing Modes Canvia entre els modes de selecció i de dibuix + Select Last Selection Tool Tria l'última eina de selecció Enable Touch Workspace Activa l’espai de treball tàctil Encoding Codificació Encoding and writing the file… S’està codificant i escrivint el fitxer… diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv index d03d192a3a..94be545cf5 100644 --- a/crates/ui-egui/src/i18n/cs.tsv +++ b/crates/ui-egui/src/i18n/cs.tsv @@ -3803,6 +3803,7 @@ theme Appearance Motiv Enable Rubber Band for Povolit gumovou čáru pro Enable Touch Gestures Povolit dotyková gesta Switch Selection and Drawing Modes Přepnout mezi režimem výběru a kreslení + Select Last Selection Tool Vybrat poslední nástroj výběru Enable Touch Workspace Povolit dotykový pracovní prostor English: UK Angličtina: Spojené království Every (minutes) Každých (minut) diff --git a/crates/ui-egui/src/i18n/da.tsv b/crates/ui-egui/src/i18n/da.tsv index 00c85aaeb6..409f9f2324 100644 --- a/crates/ui-egui/src/i18n/da.tsv +++ b/crates/ui-egui/src/i18n/da.tsv @@ -3536,6 +3536,7 @@ theme Appearance Udseende Enable Rubber Band for Aktivér gummibånd for Enable Touch Gestures Aktivér berøringsbevægelser Switch Selection and Drawing Modes Skift mellem markerings- og tegnetilstand + Select Last Selection Tool Vælg det seneste markeringsværktøj Enable Touch Workspace Aktivér touch-arbejdsområde English: UK Engelsk: UK Every (minutes) Hvert (minut) diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv index 47337855aa..eb36468471 100644 --- a/crates/ui-egui/src/i18n/de.tsv +++ b/crates/ui-egui/src/i18n/de.tsv @@ -1021,6 +1021,7 @@ font-technology Variable Variabel Enable text access for screen readers Textzugriff für Bildschirmlesegeräte zulassen Enable Touch Gestures Touch-Gesten aktivieren Switch Selection and Drawing Modes Zwischen Auswahl- und Zeichenmodus wechseln + Select Last Selection Tool Zuletzt verwendetes Auswahl-Werkzeug wählen Enable Touch Workspace Touch-Arbeitsbereich aktivieren Encoding Kodierung Encoding: Kodierung: diff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsv index c319729a71..9ca053e657 100644 --- a/crates/ui-egui/src/i18n/el.tsv +++ b/crates/ui-egui/src/i18n/el.tsv @@ -989,6 +989,7 @@ font-technology Variable Μεταβλητές Enable text access for screen readers Ενεργοποίηση πρόσβασης κειμένου για αναγνώστες οθόνης Enable Touch Gestures Ενεργοποίηση χειρονομιών αφής Switch Selection and Drawing Modes Εναλλαγή λειτουργιών επιλογής και σχεδίασης + Select Last Selection Tool Επιλογή του τελευταίου εργαλείου επιλογής Enable Touch Workspace Ενεργοποίηση χώρου εργασίας αφής Encoding Κωδικοποίηση Encoding: Κωδικοποίηση: diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv index 5b203292a4..98edc0b25f 100644 --- a/crates/ui-egui/src/i18n/es.tsv +++ b/crates/ui-egui/src/i18n/es.tsv @@ -1042,6 +1042,7 @@ font-technology Variable Variables Enable text access for screen readers Permitir el acceso al texto para lectores de pantalla Enable Touch Gestures Activar gestos táctiles Switch Selection and Drawing Modes Cambiar entre modos de selección y dibujo + Select Last Selection Tool Elegir la última herramienta de selección Enable Touch Workspace Activar espacio de trabajo táctil Encoding Codificación Encoding: Codificación: diff --git a/crates/ui-egui/src/i18n/fi.tsv b/crates/ui-egui/src/i18n/fi.tsv index b2c6f48d54..cd231f0606 100644 --- a/crates/ui-egui/src/i18n/fi.tsv +++ b/crates/ui-egui/src/i18n/fi.tsv @@ -3741,6 +3741,7 @@ theme Appearance Ulkoasu Enable Rubber Band for Ota kumilankavalinta käyttöön kohteelle Enable Touch Gestures Ota kosketuseleet käyttöön Switch Selection and Drawing Modes Vaihda valinta- ja piirtotilan välillä + Select Last Selection Tool Valitse viimeksi käytetty valintatyökalu Enable Touch Workspace Ota kosketustyötila käyttöön English: UK Englanti: UK Every (minutes) Välein (minuuttia) diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv index e84f344060..d03fd4bfa6 100644 --- a/crates/ui-egui/src/i18n/fr.tsv +++ b/crates/ui-egui/src/i18n/fr.tsv @@ -1037,6 +1037,7 @@ font-technology Variable Variables Enable text access for screen readers Autoriser l’accès au texte pour les lecteurs d’écran Enable Touch Gestures Activer les gestes tactiles Switch Selection and Drawing Modes Basculer entre les modes sélection et dessin + Select Last Selection Tool Choisir le dernier outil de sélection Enable Touch Workspace Activer l’espace de travail tactile Encoding Codage Encoding: Codage : diff --git a/crates/ui-egui/src/i18n/hi.tsv b/crates/ui-egui/src/i18n/hi.tsv index 017bc03750..858535b20d 100644 --- a/crates/ui-egui/src/i18n/hi.tsv +++ b/crates/ui-egui/src/i18n/hi.tsv @@ -1637,6 +1637,7 @@ antiAlias Sharp शार्प Enable text access for screen readers स्क्रीन रीडर के लिए टेक्स्ट एक्सेस सक्षम करें Enable Touch Gestures टच जेस्चर ऑन करें Switch Selection and Drawing Modes चयन और ड्रॉइंग मोड के बीच बदलें + Select Last Selection Tool पिछला सिलेक्शन टूल चुनें Enable Touch Workspace टच वर्कस्पेस सक्षम करें Enclosing Lasso लासो संलग्न करना Enclosing Lasso Tool लासो टूल संलग्न करना diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv index effb31e5d8..a39b65a47e 100644 --- a/crates/ui-egui/src/i18n/hu.tsv +++ b/crates/ui-egui/src/i18n/hu.tsv @@ -1322,6 +1322,7 @@ font-technology Variable Változó Enable text access for screen readers Szöveghozzáférés engedélyezése képernyőolvasóknak Enable Touch Gestures Érintési kézmozdulatok Switch Selection and Drawing Modes Váltás a kijelölési és a rajzolási mód között + Select Last Selection Tool Az utoljára használt kijelölőeszköz kiválasztása Enable Touch Workspace Érintőképernyős munkaterület Encoding Kódolás Encoding: Kódolás: diff --git a/crates/ui-egui/src/i18n/id.tsv b/crates/ui-egui/src/i18n/id.tsv index 912c6954eb..3c2d75c67a 100644 --- a/crates/ui-egui/src/i18n/id.tsv +++ b/crates/ui-egui/src/i18n/id.tsv @@ -3536,6 +3536,7 @@ theme Appearance Tampilan Enable Rubber Band for Aktifkan rubber band untuk Enable Touch Gestures Aktifkan gestur sentuh Switch Selection and Drawing Modes Beralih antara mode seleksi dan menggambar + Select Last Selection Tool Pilih alat seleksi terakhir Enable Touch Workspace Aktifkan ruang kerja sentuh English: UK Inggris: UK Every (minutes) Setiap (menit) diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv index 2d6c7e2186..8d5bdddd7f 100644 --- a/crates/ui-egui/src/i18n/it.tsv +++ b/crates/ui-egui/src/i18n/it.tsv @@ -1051,6 +1051,7 @@ font-technology Variable Variabili Enable text access for screen readers Consenti l'accesso al testo per le utilità di lettura dello schermo Enable Touch Gestures Attiva gesti touch Switch Selection and Drawing Modes Passa tra modalità selezione e disegno + Select Last Selection Tool Scegli l'ultimo strumento di selezione Enable Touch Workspace Attiva area di lavoro touch Encoding Codifica Encoding: Codifica: diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv index 17444d894e..7052dad10e 100644 --- a/crates/ui-egui/src/i18n/ja.tsv +++ b/crates/ui-egui/src/i18n/ja.tsv @@ -1642,6 +1642,7 @@ antiAlias Sharp シャープ Enable Rubber Band for ラバーバンドを有効にする対象 Enable Touch Gestures タッチジェスチャーを有効にする Switch Selection and Drawing Modes 選択モードと描画モードを切り替え + Select Last Selection Tool 最後に使用した選択ツールに切り替え Enable Touch Workspace タッチワークスペースを有効にする Enable copying of text, images and other content テキスト、イメージ、その他のコンテンツのコピーを許可 Enable in-menu font previews メニュー内でフォントプレビューを有効にする diff --git a/crates/ui-egui/src/i18n/ka.tsv b/crates/ui-egui/src/i18n/ka.tsv index be8a847cb2..fa1404c866 100644 --- a/crates/ui-egui/src/i18n/ka.tsv +++ b/crates/ui-egui/src/i18n/ka.tsv @@ -3380,6 +3380,7 @@ theme Appearance იერსახე Enable Rubber Band for რეზინის ზოლის ჩართვა: Enable Touch Gestures შეხების ჟესტების ჩართვა Switch Selection and Drawing Modes მონიშვნისა და ხატვის რეჟიმების გადართვა + Select Last Selection Tool ბოლოს გამოყენებული მონიშვნის ხელსაწყოს არჩევა Enable Touch Workspace სენსორული სამუშაო სივრცის ჩართვა English: UK ინგლისური: ბრიტანეთი Every (minutes) ყოველ (წუთში) diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv index 991daba6d0..d9640a1856 100644 --- a/crates/ui-egui/src/i18n/ko.tsv +++ b/crates/ui-egui/src/i18n/ko.tsv @@ -1632,6 +1632,7 @@ antiAlias Sharp 날카롭게 Enable Rubber Band for 러버 밴드 사용 대상 Enable Touch Gestures 터치 제스처 사용 Switch Selection and Drawing Modes 선택 모드와 그리기 모드 전환 + Select Last Selection Tool 마지막으로 사용한 선택 도구로 전환 Enable Touch Workspace 터치 작업 영역 사용 Enable copying of text, images and other content 텍스트, 이미지 및 기타 콘텐츠 복사 허용 Enable in-menu font previews 메뉴에서 글꼴 미리 보기 사용 diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsv index b8ca33858f..6cd1fc2bd3 100644 --- a/crates/ui-egui/src/i18n/nl.tsv +++ b/crates/ui-egui/src/i18n/nl.tsv @@ -4051,6 +4051,7 @@ theme Appearance Vormgeving Enable Rubber Band for Rubberband inschakelen voor Enable Touch Gestures Touchgebaren inschakelen Switch Selection and Drawing Modes Wisselen tussen selectie- en tekenmodus + Select Last Selection Tool Laatst gebruikte selectiegereedschap kiezen Enable Touch Workspace Touch-werkruimte inschakelen English: UK Engels: VK Every (minutes) Elke (minuten) diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv index eb5afe87cc..665ad1c353 100644 --- a/crates/ui-egui/src/i18n/pl.tsv +++ b/crates/ui-egui/src/i18n/pl.tsv @@ -3680,6 +3680,7 @@ theme Appearance Wygląd Enable Rubber Band for Włącz gumkę podglądu dla Enable Touch Gestures Włącz gesty dotykowe Switch Selection and Drawing Modes Przełącz tryby zaznaczania i rysowania + Select Last Selection Tool Wybierz ostatnie narzędzie zaznaczania Enable Touch Workspace Włącz dotykowy obszar roboczy English: UK Angielski: Wielka Brytania Every (minutes) Co (minuty) diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv index 80615d6370..251d045df9 100644 --- a/crates/ui-egui/src/i18n/pt-br.tsv +++ b/crates/ui-egui/src/i18n/pt-br.tsv @@ -932,6 +932,7 @@ antiAlias Sharp Nítido Enable Rubber Band for Habilitar Elástico para Enable Touch Gestures Habilitar Gestos de Toque Switch Selection and Drawing Modes Alternar Modos de Seleção e Desenho + Select Last Selection Tool Selecionar Última Ferramenta de Seleção Enable Touch Workspace Habilitar Espaço de Trabalho de Toque Enable copying of text, images and other content Habilitar cópia de texto, imagens e outro conteúdo Enable in-menu font previews Habilitar visualizações de fonte no menu diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv index c830e69b37..97281ecfb0 100644 --- a/crates/ui-egui/src/i18n/ru.tsv +++ b/crates/ui-egui/src/i18n/ru.tsv @@ -1040,6 +1040,7 @@ font-technology Variable Вариативные Enable text access for screen readers Разрешить доступ к тексту для программ чтения с экрана Enable Touch Gestures Включить сенсорные жесты Switch Selection and Drawing Modes Переключить режимы выделения и рисования + Select Last Selection Tool Выбрать последний инструмент выделения Enable Touch Workspace Включить сенсорную рабочую среду Encoding Кодировка Encoding: Кодировка: diff --git a/crates/ui-egui/src/i18n/sv.tsv b/crates/ui-egui/src/i18n/sv.tsv index d4304b97bd..ade417d700 100644 --- a/crates/ui-egui/src/i18n/sv.tsv +++ b/crates/ui-egui/src/i18n/sv.tsv @@ -1021,6 +1021,7 @@ font-technology Variable Variabla Enable text access for screen readers Ge skärmläsare åtkomst till text Enable Touch Gestures Aktivera pekgester Switch Selection and Drawing Modes Växla mellan markerings- och ritläge + Select Last Selection Tool Välj det senaste markeringsverktyget Enable Touch Workspace Aktivera arbetslayout för pekskärm Encoding Kodning Encoding: Kodning: diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsv index f5fc694ec2..afcab87b6e 100644 --- a/crates/ui-egui/src/i18n/tr.tsv +++ b/crates/ui-egui/src/i18n/tr.tsv @@ -1013,6 +1013,7 @@ font-technology Variable Değişken Enable text access for screen readers Ekran okuyucular için metin erişimini etkinleştirin Enable Touch Gestures Dokunma Hareketlerini Etkinleştir Switch Selection and Drawing Modes Seçim ve Çizim Modları Arasında Geçiş Yap + Select Last Selection Tool Son Kullanılan Seçim Aracını Seç Enable Touch Workspace Dokunmatik Çalışma Alanını Etkinleştir Encoding Kodlama Encoding: Kodlama: diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv index 5a36512db0..0bed28992d 100644 --- a/crates/ui-egui/src/i18n/uk.tsv +++ b/crates/ui-egui/src/i18n/uk.tsv @@ -1045,6 +1045,7 @@ font-technology Variable Варіативні Enable text access for screen readers Дозволити доступ до тексту для програм читання з екрану Enable Touch Gestures Увімкнути сенсорні жести Switch Selection and Drawing Modes Перемкнути режими виділення та малювання + Select Last Selection Tool Вибрати останній інструмент виділення Enable Touch Workspace Включити сенсорне робоче середовище Encoding Кодування Encoding: Кодування: diff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsv index 839f5c7405..1a9c3a431d 100644 --- a/crates/ui-egui/src/i18n/vi.tsv +++ b/crates/ui-egui/src/i18n/vi.tsv @@ -1212,6 +1212,7 @@ font-technology Variable Biến thiên Enable text access for screen readers Bật truy cập văn bản cho trình đọc màn hình Enable Touch Gestures Bật cử chỉ cảm ứng Switch Selection and Drawing Modes Chuyển giữa chế độ chọn và vẽ + Select Last Selection Tool Chọn công cụ chọn dùng gần nhất Enable Touch Workspace Bật không gian làm việc cảm ứng Encoding Mã hóa Encoding: Mã hóa: diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv index b0d6001e32..f5622cf162 100644 --- a/crates/ui-egui/src/i18n/zh-hans.tsv +++ b/crates/ui-egui/src/i18n/zh-hans.tsv @@ -983,6 +983,7 @@ antiAlias Sharp 锐利 Enable text access for screen readers 启用屏幕阅读器的文字访问 Enable Touch Gestures 启用触控手势 Switch Selection and Drawing Modes 切换选择与绘图模式 + Select Last Selection Tool 切换到上次使用的选择工具 Enable Touch Workspace 启用触控工作区 Encoding 编码 Encoding: 编码: diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv index c24ae37609..1e5abe580f 100644 --- a/crates/ui-egui/src/i18n/zh-hant.tsv +++ b/crates/ui-egui/src/i18n/zh-hant.tsv @@ -1013,6 +1013,7 @@ font-technology Variable 可變 Enable text access for screen readers 啟用螢幕閱讀器的文字存取 Enable Touch Gestures 啟用觸控手勢 Switch Selection and Drawing Modes 切換選取與繪圖模式 + Select Last Selection Tool 切換到上次使用的選取工具 Enable Touch Workspace 啟用觸控工作區 Encoding 編碼 Encoding: 編碼: diff --git a/crates/ui-egui/src/keymap.rs b/crates/ui-egui/src/keymap.rs index d32ae53d5d..79e53edfdd 100644 --- a/crates/ui-egui/src/keymap.rs +++ b/crates/ui-egui/src/keymap.rs @@ -216,7 +216,7 @@ fn catalogue(snapshot: &Snapshot, p: Platform) -> Vec { if TOGGLES.contains(&e.key.as_str()) { b = b.toggle(); } - if let Some(d) = shortcut_editor::default_of(&e.key).and_then(vc_binding) { + if let Some(d) = shortcut_editor::default_on(&e.key, p).and_then(vc_binding) { b = b.with_default(d); } for alias in default_aliases(&e.key, p) { @@ -639,6 +639,26 @@ mod tests { } } + /// Select Last Selection Tool is Ctrl+` on Windows and Linux. macOS takes Cmd+` to switch + /// between an app's windows, so there the command has no default and takes a chord the user + /// assigns. + #[test] + fn last_selection_tool_default_follows_the_platform() { + let snapshot = shortcut_editor::snapshot(); + let command = command_of("tool.selectLastSelection"); + let chord = vc_chord("Cmd+~").unwrap(); + for p in [Platform::Windows, Platform::Linux] { + let km = keymap_for(p, &snapshot); + assert_eq!(lookup(&km, &chord), Some(command.clone()), "{p:?}"); + assert_eq!(shortcut_editor::default_on("tool.selectLastSelection", p), Some("Cmd+~"), "{p:?}"); + } + let mut mac = keymap_for(Platform::Mac, &snapshot); + assert_eq!(mac.bindings(&command), vec![], "no default on macOS"); + assert_eq!(shortcut_editor::default_on("tool.selectLastSelection", Platform::Mac), None); + shortcut_editor::assign_in(&mut mac, "tool.selectLastSelection", Some("Alt+~"), true).unwrap(); + assert_eq!(lookup(&mac, &vc_chord("Alt+~").unwrap()), Some(command)); + } + #[test] fn panel_entries_bridge_to_window_panel() { let c = command_of("panel:layers"); diff --git a/crates/ui-egui/src/menus/run.rs b/crates/ui-egui/src/menus/run.rs index efa4e95ac4..32af53ba16 100644 --- a/crates/ui-egui/src/menus/run.rs +++ b/crates/ui-egui/src/menus/run.rs @@ -677,13 +677,15 @@ fn run_ui_part6(app: &mut VectorcraftApp, id: &str, p: &Value) -> Option crate::chrome::step_document(app, true), "window.previousDocument" => crate::chrome::step_document(app, false), "tool.select" => match s("tool") { - Some(t) if vectorcraft_tools::tool_info(&t).is_some() => { - app.select_tool(&t); - Ok(json!({"tool": app.session.tool_id()})) - } + Some(t) if vectorcraft_tools::tool_info(&t).is_some() => app.try_select_tool(&t).map(|()| json!({"tool": app.session.tool_id()})), Some(t) => Err(format!("unknown tool `{t}`")), None => Err("missing `tool`".into()), }, + "tool.selectLastSelection" => { + let id = app.session.last_selection_tool(); + let switched = if app.session.tool_id() == id { Ok(()) } else { app.try_select_tool(id) }; + switched.map(|()| json!({"tool": app.session.tool_id()})) + } crate::touch::TOGGLE_MODE => Ok(crate::touch::toggle_mode(app)), crate::addons::pathtools::corner::COMMAND => crate::addons::pathtools::corner::open(app), crate::addons::pathtools::shared_edge::COMMAND => crate::addons::pathtools::shared_edge::open(app), diff --git a/crates/ui-egui/src/menus/ui_commands.rs b/crates/ui-egui/src/menus/ui_commands.rs index 31340a3a48..65441f3c2a 100644 --- a/crates/ui-egui/src/menus/ui_commands.rs +++ b/crates/ui-egui/src/menus/ui_commands.rs @@ -772,6 +772,12 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[ "{} make the open document before the current one in tab order the current one, as a click on its tab does (before the first document it goes to the last, and from the Home screen to the last); each view window.newWindow opened is a step of its own; returns {index}, with `view` for a document with more than one view", ), ("tool.select", "Select Tool", "", "{tool: id} (see tools)"), + ( + "tool.selectLastSelection", + "Select Last Selection Tool", + "Cmd+~", + "{} choose the selection tool chosen last (Selection, Direct Selection or Group Selection; none yet: the Selection tool), keeping the active tool when it is that tool; choosing Magic Wand, Lasso or any other tool does not change which one it chooses → {tool}. Default shortcut Ctrl+` on Windows and Linux, none on macOS, where Cmd+` switches windows", + ), ( "tool.setOption", "Tool Option", diff --git a/crates/ui-egui/src/shortcut_editor.rs b/crates/ui-egui/src/shortcut_editor.rs index 4e02180017..027893f0ab 100644 --- a/crates/ui-egui/src/shortcut_editor.rs +++ b/crates/ui-egui/src/shortcut_editor.rs @@ -152,12 +152,23 @@ pub fn sync(ui: &UiState) { crate::custom_toolbars::sync(ui); } -/// Registry default shortcut of a command (engine or UI command). +/// Registry default shortcut of a command (engine or UI command) on [`crate::keymap::platform`]. pub fn default_command_shortcut(id: &str) -> Option<&'static str> { + default_command_shortcut_on(id, crate::keymap::platform()) +} + +/// Registry default shortcut of a command on platform `p`. +fn default_command_shortcut_on(id: &str, p: craft_keymap::Platform) -> Option<&'static str> { if let Some(c) = vectorcraft_engine::find_command(id) { return c.shortcut; } - menus::UI_COMMANDS.iter().find(|c| c.0 == id).map(|c| c.2).filter(|s| !s.is_empty()) + menus::UI_COMMANDS.iter().find(|c| c.0 == id).map(|c| ui_command_default(c.0, c.2, p)).filter(|s| !s.is_empty()) +} + +/// The default shortcut `sc` of UI command `id` on platform `p` (empty for none). Select Last +/// Selection Tool has none on macOS, which takes Cmd+` to switch between an app's windows. +pub(crate) fn ui_command_default(id: &str, sc: &'static str, p: craft_keymap::Platform) -> &'static str { + if id == "tool.selectLastSelection" && p.is_mac() { "" } else { sc } } /// Window menu items that show a panel (`window.panel {panel}`) with a default shortcut: (panel @@ -184,15 +195,21 @@ pub const PANEL_SHORTCUTS: &[(&str, &str)] = &[ ("openType", "Cmd+Alt+Shift+T"), ]; -/// Default shortcut of an entry key (`tool:`, `panel:` or a command id). +/// Default shortcut of an entry key (`tool:`, `panel:` or a command id) on +/// [`crate::keymap::platform`]. pub fn default_of(key: &str) -> Option<&'static str> { + default_on(key, crate::keymap::platform()) +} + +/// Default shortcut of an entry key on platform `p`. +pub(crate) fn default_on(key: &str, p: craft_keymap::Platform) -> Option<&'static str> { if let Some(t) = key.strip_prefix("tool:") { return vectorcraft_tools::tool_info(t).and_then(|t| t.shortcut); } - if let Some(p) = key.strip_prefix("panel:") { - return PANEL_SHORTCUTS.iter().find(|(id, _)| *id == p).map(|(_, sc)| *sc); + if let Some(panel) = key.strip_prefix("panel:") { + return PANEL_SHORTCUTS.iter().find(|(id, _)| *id == panel).map(|(_, sc)| *sc); } - default_command_shortcut(key) + default_command_shortcut_on(key, p) } /// Effective shortcut of an entry key, honouring the user's overrides. diff --git a/crates/ui-egui/src/shortcuts/tests.rs b/crates/ui-egui/src/shortcuts/tests.rs index 60b8c5eacd..b07039e1db 100644 --- a/crates/ui-egui/src/shortcuts/tests.rs +++ b/crates/ui-egui/src/shortcuts/tests.rs @@ -3096,3 +3096,27 @@ fn artboard_navigation_commands_can_be_given_keys() { frame(&mut app, press(Key::PageUp)); assert_eq!(at(&app), 1, "Page Up goes to the previous artboard"); } + +/// Ctrl+` (Windows and Linux) chooses the selection tool chosen last; macOS gives the command no +/// default key. Edit › Keyboard Shortcuts lists it, and a chord the user assigns runs it. +#[test] +fn ctrl_backtick_chooses_the_last_selection_tool() { + let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), Default::default()); + app.session.execute("file.new", &json!({"width": 200, "height": 200})).unwrap(); + let mac = crate::keymap::platform().is_mac(); + let list = app.run("shortcuts.list", json!({ "query": "tool.selectLastSelection" })).unwrap(); + let listed = list.as_array().unwrap().iter().find(|e| e["id"] == "tool.selectLastSelection").cloned(); + let listed = listed.unwrap_or_else(|| panic!("listed: {list}")); + assert_eq!(listed["label"], "Select Last Selection Tool"); + assert_eq!(listed["default"], if mac { json!(null) } else { json!("Cmd+~") }); + app.select_tool("directSelection"); + app.select_tool("pen"); + frame(&mut app, press(Key::Backtick, cmd())); + assert_eq!(app.session.tool_id(), if mac { "pen" } else { "directSelection" }); + crate::keymap::set_override(&mut app.ui.shortcut_overrides, "tool.selectLastSelection", "Alt+~"); + app.select_tool("groupSelection"); + app.select_tool("rectangle"); + frame(&mut app, press(Key::Backtick, Modifiers::ALT)); + assert_eq!(app.session.tool_id(), "groupSelection", "the user's chord"); + crate::shortcut_editor::sync(&crate::state::UiState::default()); +} diff --git a/docs/mcp.md b/docs/mcp.md index 59bb3c78ad..e02cb5451d 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -1392,7 +1392,8 @@ vectorcraft-cli run --cmd file.new --params '{"width":800,"height":600}' \ `run` prints one JSON line per step (`open`, `cmd`, `export`) and exits non-zero on the first failure, naming the step (counting from 0, as `"$N"` references do) and its command. `--params` applies to the `--cmd` just before it. `run` -also accepts the host commands `file.open`, `file.save`, `file.export`, `file.exportForScreens` and `tool.select`. +also accepts the host commands `file.open`, `file.save`, `file.export`, `file.exportForScreens`, `tool.select` and +`tool.selectLastSelection`. `run --in`, `convert` and `info` read every format `document.open` reads (`vectorcraft-cli --help` lists them). ### Steps from a file or standard input @@ -4967,6 +4968,15 @@ macOS, Ctrl elsewhere), drags with the selection tool chosen last (`select_tool` Curvature and anchor tools until one is chosen; the release gives the tool back as it was, so the Pen goes on drawing the path it had begun while that stays selected. Its reply's `tool` is the tool given back. +`tool.selectLastSelection` (Select Last Selection Tool, `{}`) chooses the selection tool chosen last, as Ctrl+` does on +Windows and Linux ([the help page](https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html) lists the +shortcut among those for selections). Only Selection, Direct Selection and Group Selection count: choosing Magic Wand, +Lasso or any other tool leaves the remembered one as it was. Before any of the three is chosen it chooses the Selection +tool; with the remembered tool already active it keeps it, so running it again does not cycle. It returns `{tool}` and +adds no undo step. On macOS it has no default shortcut, because the system uses Command+` to switch between an app's +windows; Edit › Keyboard Shortcuts can assign one. The Selection tool as the first choice and the macOS default are +VectorCraft's own rules. The headless backend and `vectorcraft-cli run` run it too. + ```json {"name":"pointer_gesture","arguments":{"tool":"pen","events":[{"kind":"down","x":100,"y":300},{"kind":"up","x":100,"y":300},{"kind":"down","x":200,"y":300},{"kind":"drag","x":250,"y":300},{"kind":"up","x":250,"y":300}]}} {"name":"pointer_gesture","arguments":{"mods":{"cmd":true},"events":[{"kind":"down","x":250,"y":300},{"kind":"drag","x":250,"y":260},{"kind":"up","x":250,"y":260}]}} diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 7044797d5e..721e6aa41e 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -973,6 +973,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - Cmd/Ctrl+Alt+N (`file.newWithoutDialog`) makes a document without opening the New Document dialog, on the key the reference app's [Default keyboard shortcuts](https://web.archive.org/web/20260726060015/https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html) page assigns to creating a document directly. The page does not say which settings the document gets. VectorCraft gives it the settings the dialog opens on (the first Recent entry, or the Print category's Letter while Recent is empty) and the next untitled name. - Cmd/Ctrl+F6 (`window.nextDocument`) and Cmd/Ctrl+Shift+F6 (`window.previousDocument`) make the next and the previous open document the current one, in tab order and as a click on its tab does, on the keys the reference app's [Default keyboard shortcuts](https://web.archive.org/web/20260726060015/https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html) page lists for navigating to the next and the previous document. After the last document comes the first, and before the first document comes the last. From the Home screen the keys go to the first and the last document. Keyboard Shortcuts lists both under Window. - Cmd/Ctrl+Alt+Shift+U (`document.switchUnits`) switches the document to the next unit of measurement, in one undo step, on the key the reference app's [Default keyboard shortcuts](https://web.archive.org/web/20260726060015/https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html) page lists for switching units of measurement. The page does not give an order. VectorCraft steps through the units in the order a right-click on a ruler lists them (Points, Picas, Inches, Millimeters, Centimeters, Pixels, Feet & Inches, Meters, Yards, Feet) and goes from Feet back to Points. + - Ctrl+` (`tool.selectLastSelection`, Select Last Selection Tool) on Windows and Linux chooses the selection tool chosen last of Selection, Direct Selection and Group Selection, on the key [the help page](https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html) lists for switching to the last-used selection tool; Magic Wand and Lasso do not count. Before one is chosen it chooses the Selection tool, and it keeps the remembered tool when that tool is already active. On macOS it has no default shortcut, because the system uses Command+` to switch between an app's windows; Edit › Keyboard Shortcuts can assign one. The first choice and the macOS default are VectorCraft's own rules. - Shortcut sets other apps save as text (`.kys`) open in Import Shortcut Set from File › Open, from Edit › Keyboard Shortcuts › Import… in the desktop app, or from a drop on the window. It matches each entry to a tool, command or panel by name and decodes the file's key and modifier codes where VectorCraft's default shortcuts agree on them; the user answers the rest, and Apply fills the Keyboard Shortcuts dialog's working set. The answers are kept with the preferences for the next import (`shortcutSet.read`, `importMatches.*`). - Edit › Keyboard Shortcuts › Export Text… saves the set shown in the dialog as a UTF-8 text file, as the reference app's [Export keyboard shortcuts list as a text document](https://helpx.adobe.com/illustrator/desktop/get-started/preferences-and-settings/export-keyboard-shortcuts-list.html) page describes (`shortcuts.exportText {path?}`). The layout is VectorCraft's own: the set's name, then the Tools and Menu Commands rows in the dialog's order, each with its name, a tab and its shortcuts as the dialog shows them, and nothing after the tab for a row with no shortcut. Tests `shortcut_editor::tests::export_text_*` and `tests::picks::keyboard_shortcuts_export_text_writes_the_working_set_as_text`. - On Windows and Linux the app bar is the window's title bar (its own minimize, maximize and close buttons, drag to move, edges to resize), with the dragon app icon as the brand mark; dialogs and menus size to their content. As on a native menu bar, once one menu is open, moving the pointer onto another title opens that one.