mock: バリアントグループを選んでキーを足すと、表示中のバリアントに新しい行を作る(T-30 単位6)

クラスターを選んだときと同じ挙動にそろえる。これまではグループの右隣(親の中)に足していた。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XsamNKrWY3obJwR746oQRq
This commit is contained in:
2026-10-23 08:23:44 +09:00
co-authored by Claude Opus 5.5
parent e5678d79e6
commit 50e672768b
3 changed files with 30 additions and 6 deletions
+8 -5
View File
@@ -128,13 +128,16 @@ export function usePhyCommands(options: Options) {
function keyAdd() {
const chosen = options.node(options.selected.value.at(-1) || "");
// A selected cluster receives a new row inside it, like an empty selection inside the focus.
// A selected cluster, or the shown variant of a selected group, receives a new row inside it,
// like an empty selection inside the focus.
const parent =
chosen?.type === "cluster"
? chosen.id
: chosen
? options.selectedContainer(chosen.id)
: insertionParent();
: chosen?.type === "variantGroup"
? options.variants.value[chosen.id] || chosen.default
: chosen
? options.selectedContainer(chosen.id)
: insertionParent();
const keys = nodesInContainer(parent).flatMap((node) =>
node.type === "key" ? [{ id: node.id, x: node.transform.x, y: node.transform.y, ...node.size }] : [],
);
@@ -143,7 +146,7 @@ export function usePhyCommands(options: Options) {
const { x, y } =
chosen?.type === "key"
? rowEndPosition(keys, chosen.id)!
: chosen && chosen.type !== "cluster"
: chosen?.type === "component"
? { x: snap(chosen.transform.x + 1), y: snap(chosen.transform.y) }
: (newRowPosition(keys) ?? { x: snap(center.x), y: snap(center.y) });
let id = "";