From 58af33aa1d6abd6b61e847a63c3ce221b36717c6 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sun, 11 Oct 2026 04:56:56 -0700 Subject: [PATCH] Palette: the entry that cancels the key object reads Cancel Key Object The command palette listed select.key as Set Key Object. A pick runs the command without an id, which cancels the key object (#541). select.key is now labeled Cancel Key Object, the label of the Align panel menu item that also cancels the key object. The palette lists it once, and engine.commands reports the new label. The params text and docs/mcp.md say that select.key {id} makes id the key object, and that select.key {}, or an id that names no selected object, cancels it. The Set Key Object rows are removed from the 10 catalogs that had one. Docs: the select.key params text, docs/mcp.md, docs/target-app-parity.md. # Conflicts: # crates/engine/src/cmd/select.rs # docs/mcp.md # docs/target-app-parity.md --- crates/engine/src/cmd/select.rs | 4 ++-- crates/ui-egui/src/i18n/de.tsv | 1 - crates/ui-egui/src/i18n/es.tsv | 1 - crates/ui-egui/src/i18n/fr.tsv | 1 - crates/ui-egui/src/i18n/it.tsv | 1 - crates/ui-egui/src/i18n/ja.tsv | 1 - crates/ui-egui/src/i18n/pt-br.tsv | 1 - crates/ui-egui/src/i18n/ru.tsv | 1 - crates/ui-egui/src/i18n/uk.tsv | 1 - crates/ui-egui/src/i18n/zh-hans.tsv | 1 - crates/ui-egui/src/i18n/zh-hant.tsv | 1 - crates/ui-egui/src/palette.rs | 23 +++++++++++++++++++++++ docs/mcp.md | 3 ++- docs/target-app-parity.md | 1 + 14 files changed, 28 insertions(+), 13 deletions(-) diff --git a/crates/engine/src/cmd/select.rs b/crates/engine/src/cmd/select.rs index 648faa89..24d206ac 100644 --- a/crates/engine/src/cmd/select.rs +++ b/crates/engine/src/cmd/select.rs @@ -62,10 +62,10 @@ pub fn specs() -> Vec { ), cmd!( "select.key", - "Set Key Object", + "Cancel Key Object", [], None, - "{id?: a selected top-level object (not a layer, a compound-path member or an object inside another selected object), one of two or more (the Selection tool: a click on one object of a selection of several; on the key again: no id)} the key object Align aligns to and Distribute Spacing spaces from; without `id` it clears the key, as does a selection that holds only the key and objects inside it (one object, or a group key and its own members); any other id is an error that leaves the key as it was → {key} (the resulting key object, or null)", + "{id?: a selected top-level object (not a layer, a compound-path member or an object inside another selected object), one of two or more (the Selection tool: a click on one object of a selection of several; on the key again: no id)} the key object Align aligns to and Distribute Spacing spaces from; without `id` it cancels the key, as does a selection that holds only the key and objects inside it (one object, or a group key and its own members); any other id is an error that leaves the key as it was → {key} (the resulting key object, or null)", has_doc, key ), diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv index 2ddd00ff..fe93142d 100644 --- a/crates/ui-egui/src/i18n/de.tsv +++ b/crates/ui-egui/src/i18n/de.tsv @@ -2474,7 +2474,6 @@ Set base color to the current color Aktuelle Farbe als Grundfarbe festlegen Set Bounds Begrenzung festlegen Set Current Layer Aktuelle Ebene festlegen - Set Key Object Basisobjekt festlegen Set Keyboard Shortcut Tastaturbefehl festlegen Set Mesh Point Color Farbe des Gitterpunkts festlegen Set Preference Voreinstellung festlegen diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv index fbd5cc46..7167403d 100644 --- a/crates/ui-egui/src/i18n/es.tsv +++ b/crates/ui-egui/src/i18n/es.tsv @@ -2525,7 +2525,6 @@ Set base color to the current color Definir el color actual como color base Set Bounds Definir límites Set Current Layer Definir capa actual - Set Key Object Definir objeto clave Set Keyboard Shortcut Definir método abreviado de teclado Set Mesh Point Color Definir color de punto de malla Set Preference Definir preferencia diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv index d077f86f..127a4e9c 100644 --- a/crates/ui-egui/src/i18n/fr.tsv +++ b/crates/ui-egui/src/i18n/fr.tsv @@ -2522,7 +2522,6 @@ Set base color to the current color Utiliser la couleur actuelle comme couleur de base Set Bounds Définir les limites Set Current Layer Définir le calque actif - Set Key Object Définir l’objet clé Set Keyboard Shortcut Définir un raccourci clavier Set Mesh Point Color Définir la couleur du point de filet Set Preference Définir une préférence diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv index 8eea85f2..4ed4c7c3 100644 --- a/crates/ui-egui/src/i18n/it.tsv +++ b/crates/ui-egui/src/i18n/it.tsv @@ -2525,7 +2525,6 @@ Set base color to the current color Imposta il colore corrente come colore di base Set Bounds Imposta limiti Set Current Layer Imposta livello corrente - Set Key Object Imposta oggetto chiave Set Keyboard Shortcut Imposta scelta rapida da tastiera Set Mesh Point Color Imposta colore punto trama Set Preference Imposta preferenza diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv index 6ee91166..144db545 100644 --- a/crates/ui-egui/src/i18n/ja.tsv +++ b/crates/ui-egui/src/i18n/ja.tsv @@ -2392,7 +2392,6 @@ Set Anchors アンカーポイントを設定 Set Bounds 境界を設定 Set Current Layer 現在のレイヤーを設定 - Set Key Object キーオブジェクトを設定 Set Keyboard Shortcut キーボードショートカットを設定 Set Mesh Point Color メッシュポイントのカラーを設定 Set Preference 環境設定を設定 diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv index f4f83d24..f22f9b41 100644 --- a/crates/ui-egui/src/i18n/pt-br.tsv +++ b/crates/ui-egui/src/i18n/pt-br.tsv @@ -2115,7 +2115,6 @@ Set Anchors Definir Âncoras Set Bounds Definir Limites Set Current Layer Definir Camada Atual - Set Key Object Definir Objeto-Chave Set Keyboard Shortcut Definir Atalho de Teclado Set Mesh Point Color Definir Cor do Ponto de Malha Set Preference Definir Preferência diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv index ab93b3d4..b473c5fb 100644 --- a/crates/ui-egui/src/i18n/ru.tsv +++ b/crates/ui-egui/src/i18n/ru.tsv @@ -2521,7 +2521,6 @@ Set base color to the current color Сделать текущий цвет базовым Set Bounds Задать границы Set Current Layer Сделать слой текущим - Set Key Object Задать ключевой объект Set Keyboard Shortcut Задать сочетание клавиш Set Mesh Point Color Задать цвет точки сетки Set Preference Задать настройку diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv index 81321849..b4281f29 100644 --- a/crates/ui-egui/src/i18n/uk.tsv +++ b/crates/ui-egui/src/i18n/uk.tsv @@ -2517,7 +2517,6 @@ Set base color to the current color Зробити поточний колір базовим Set Bounds Задати межі Set Current Layer Зробити шар поточним - Set Key Object Задати ключовий об’єкт Set Keyboard Shortcut Задати клавіші Set Mesh Point Color Задати колір точки сітки Set Preference Задати налаштування diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv index da0845a9..62fe742c 100644 --- a/crates/ui-egui/src/i18n/zh-hans.tsv +++ b/crates/ui-egui/src/i18n/zh-hans.tsv @@ -2414,7 +2414,6 @@ Set base color to the current color 将基色设为当前颜色 Set Bounds 设置边界 Set Current Layer 设为当前图层 - Set Key Object 设为关键对象 Set Keyboard Shortcut 设置键盘快捷键 Set Mesh Point Color 设置网格点颜色 Set Preference 设置首选项 diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv index eb91ad05..bb296f3d 100644 --- a/crates/ui-egui/src/i18n/zh-hant.tsv +++ b/crates/ui-egui/src/i18n/zh-hant.tsv @@ -2503,7 +2503,6 @@ Set base color to the current color 將基本色設為目前顏色 Set Bounds 設定邊界 Set Current Layer 設定目前圖層 - Set Key Object 設定關鍵物件 Set Keyboard Shortcut 設定鍵盤快速鍵 Set Mesh Point Color 設定網格點顏色 Set Preference 設定偏好設定 diff --git a/crates/ui-egui/src/palette.rs b/crates/ui-egui/src/palette.rs index 5294b241..d6fa2955 100644 --- a/crates/ui-egui/src/palette.rs +++ b/crates/ui-egui/src/palette.rs @@ -147,4 +147,27 @@ mod tests { assert!(group.haystack.contains(&word.to_lowercase()), "{word}"); } } + + /// The palette lists `select.key` once, as Cancel Key Object (#541): a pick runs it with no id, + /// which cancels the key object. `engine.commands` gives agents the same label. + #[test] + fn the_palette_lists_cancel_key_object_once() { + let items = items(); + let ids: Vec<&str> = items.iter().filter(|(label, ..)| label == "Cancel Key Object").map(|(_, id, _)| id.as_str()).collect(); + assert_eq!(ids, ["select.key"]); + let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), crate::Services::default()); + let commands = crate::control::all_commands(&app); + let key = commands.as_array().unwrap().iter().find(|c| c["id"] == "select.key").unwrap(); + assert_eq!(key["label"], "Cancel Key Object"); + app.run("file.new", json!({"width": 200, "height": 200})).unwrap(); + let a = app.run("shape.rectangle", json!({"x": 10, "y": 10, "width": 10, "height": 10})).unwrap()["id"].clone(); + let b = app.run("shape.rectangle", json!({"x": 80, "y": 50, "width": 30, "height": 30})).unwrap()["id"].clone(); + app.run("select.set", json!({"ids": [a, b]})).unwrap(); + app.run("select.key", json!({"id": b})).unwrap(); + assert!(app.session.active().unwrap().selection.key.is_some()); + // Run a pick the way `show` runs it. + menus::invoke(&mut app, ids[0], json!({})); + let st = app.session.active().unwrap(); + assert_eq!((st.selection.len(), st.selection.key), (2, None), "both objects stay selected, without a key"); + } } diff --git a/docs/mcp.md b/docs/mcp.md index 57c9cd80..75e2d011 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -724,7 +724,7 @@ A malformed or unknown id is an error naming that value; the entire selection is All three commands return `{count, ids}` for the resulting selection, in selection order. An empty array clears the selection for `select.set` and leaves it alone for Add and Toggle. -`select.key {id}` makes `id` the key object that Align aligns to and Distribute Spacing spaces from (`object.align` without `to`, `object.distributeSpacing` with `spacing`), and `select.key {}` clears it. +`select.key {id}` makes `id` the key object that Align aligns to and Distribute Spacing spaces from (`object.align` without `to`, `object.distributeSpacing` with `spacing`), and `select.key {}` cancels it. The id must name a selected top-level object. Layers, compound-path members and objects inside another selected object are not top-level objects. Any other id is an error naming that value, and the key is left unchanged. @@ -734,6 +734,7 @@ On a single selected object, or on a group selected with only its own members, ` It returns `{key}`, the key object's id or null. `document.inspect` (the `inspect_document` tool) reports the key object as `key`, null without one. The `ui.pointer` and `pointer_gesture` replies list it as `key` beside `selection`. +The command palette lists `select.key` as Cancel Key Object and runs it without an id. `edit.clear {ids?}` deletes the exact selected objects, including individual compound-path members; their unselected siblings remain in the compound. Supplying `ids` works without a selection and diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 8332514b..df81a365 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -398,6 +398,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - **Selection:** Selection, Direct/Group Selection, Magic Wand, Lasso. A Shift-drag marquee toggles what it reaches: objects with the Selection tool, anchors with Direct and Group Selection (#483); the Lasso adds with Shift and subtracts with Alt. Dragging a path segment with Direct Selection bends it when it's curved (its anchors stay) and moves its two anchors when it's straight, one undo step; the fill, Shift or Alt still pick the whole path (Alt-drag copies it). A key object needs another selected object outside it. A Shift-click or any other change that leaves one object selected clears the key, and `select.key` sets none on one object or on a group selected with only its own members. With one object selected, the Align panel, the Control bar and the Properties panel align it to the artboard whatever Align To is set to. With two or more objects selected and no key object, Align to Key Object makes the topmost of them the key, whatever order they were selected in, and the Align panel, the Control bar and the Properties panel align to it. Align To keeps its Selection or Artboard choice and shows it again once the key is cleared. + The command palette lists `select.key` as Cancel Key Object, and a pick cancels the key object (#541). Agent selection commands validate every object id before changing the selection and report the resulting count and ids (#784). Agents read the key object: `select.key` returns it, and `document.inspect` and the `ui.pointer` and `pointer_gesture` replies report it as `key`. `select.key` with an id that isn't a selected top-level object returns an error and leaves the key unchanged. Align and Distribute Spacing keep a compound path or selected group that contains the key object in place, as they keep the key object itself.