Skip to content

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.rs
index 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.tsv
index 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 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 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 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 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 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 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 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 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.tsv
index 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 Â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 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.tsv
index 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.tsv
index 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.tsv
index 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.rs
index 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.md
index 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 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 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.