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
This commit is contained in:
dotCooCoo 2026-10-11 04:56:56 -07:00 committed by bflatastic
parent 4ab69b877e
commit 58af33aa1d
14 changed files with 28 additions and 13 deletions

View File

@ -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
),

View File

@ -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

Can't render this file because it contains an unexpected character in line 2 and column 73.

View File

@ -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

Can't render this file because it contains an unexpected character in line 2 and column 73.

View File

@ -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

Can't render this file because it contains an unexpected character in line 2 and column 73.

View File

@ -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

Can't render this file because it contains an unexpected character in line 2 and column 73.

View File

@ -2392,7 +2392,6 @@
Set Anchors アンカーポイントを設定
Set Bounds 境界を設定
Set Current Layer 現在のレイヤーを設定
Set Key Object キーオブジェクトを設定
Set Keyboard Shortcut キーボードショートカットを設定
Set Mesh Point Color メッシュポイントのカラーを設定
Set Preference 環境設定を設定

Can't render this file because it contains an unexpected character in line 2 and column 73.

View File

@ -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

Can't render this file because it contains an unexpected character in line 6 and column 47.

View File

@ -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 Задать настройку

Can't render this file because it contains an unexpected character in line 2 and column 73.

View File

@ -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 Задати налаштування

Can't render this file because it has a wrong number of fields in line 13.

View File

@ -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 设置首选项

Can't render this file because it contains an unexpected character in line 2 and column 73.

View File

@ -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 設定偏好設定

Can't render this file because it contains an unexpected character in line 6 and column 47.

View File

@ -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");
}
}

View File

@ -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

View File

@ -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.