VectorCraft: An open-source, vector art tool written by scratch in pure Rust
Palette: the entry that cancels the key object reads Cancel Key Object
dotCooCoo58af33aa1d6a
diff --git a/crates/engine/src/cmd/select.rs b/crates/engine/src/cmd/select.rsindex 648faa894..24d206acf 100644--- a/crates/engine/src/cmd/select.rs+++ b/crates/engine/src/cmd/select.rs@@ -62,10 +62,10 @@ pub fn specs() -> Vec<CommandSpec> {),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.tsvindex 2ddd00ffe..fe93142d2 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 festlegenSet Bounds Begrenzung festlegenSet Current Layer Aktuelle Ebene festlegen- Set Key Object Basisobjekt festlegenSet Keyboard Shortcut Tastaturbefehl festlegenSet Mesh Point Color Farbe des Gitterpunkts festlegenSet Preference Voreinstellung festlegendiff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsvindex fbd5cc466..7167403d4 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 baseSet Bounds Definir límitesSet Current Layer Definir capa actual- Set Key Object Definir objeto claveSet Keyboard Shortcut Definir método abreviado de tecladoSet Mesh Point Color Definir color de punto de mallaSet Preference Definir preferenciadiff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsvindex d077f86f3..127a4e9ca 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 baseSet Bounds Définir les limitesSet Current Layer Définir le calque actif- Set Key Object Définir l’objet cléSet Keyboard Shortcut Définir un raccourci clavierSet Mesh Point Color Définir la couleur du point de filetSet Preference Définir une préférencediff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsvindex 8eea85f26..4ed4c7c38 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 baseSet Bounds Imposta limitiSet Current Layer Imposta livello corrente- Set Key Object Imposta oggetto chiaveSet Keyboard Shortcut Imposta scelta rapida da tastieraSet Mesh Point Color Imposta colore punto tramaSet Preference Imposta preferenzadiff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsvindex 6ee911662..144db5451 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.tsvindex f4f83d245..f22f9b41d 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 ÂncorasSet Bounds Definir LimitesSet Current Layer Definir Camada Atual- Set Key Object Definir Objeto-ChaveSet Keyboard Shortcut Definir Atalho de TecladoSet Mesh Point Color Definir Cor do Ponto de MalhaSet Preference Definir Preferênciadiff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsvindex ab93b3d49..b473c5fb2 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.tsvindex 813218495..b4281f293 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.tsvindex da0845a94..62fe742c7 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.tsvindex eb91ad05e..bb296f3d0 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.rsindex 5294b241d..d6fa2955f 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.mdindex 57c9cd807..75e2d011c 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 isAll 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 anddiff --git a/docs/target-app-parity.md b/docs/target-app-parity.mdindex 8332514ba..df81a365e 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.