node.reparent: index is the layer's final position (#992)

`node.reparent {ids, parent, index}` read `index` against the parent's
children as they were before the move, so within the same parent moving a
layer up one place did nothing and asking for two places moved it one.
`index` now counts the parent's children after the move, the way
`node.reorder` already does, in the same parent or a new one; several
layers still land together in their stacking order.

The layers panel was the only caller passing an index other than 0. It
drops on a gap between rows counted before the move, so it now subtracts
the dragged layers below that gap and drags behave as before.

Documents `index` in the command's params and in docs/mcp.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Kameron
2026-10-21 11:03:08 -07:00
co-authored by Claude Opus 5.5
parent 35da7b7cff
commit 3146ad2b2f
5 changed files with 80 additions and 14 deletions
+6
View File
@@ -190,6 +190,12 @@ Or in a project's `.mcp.json`:
the CSS `fr` unit: a track never gets less than its content (a fixed-size child bigger than
its share keeps it; the other `fr` tracks share the rest). `inspect` reports a grid child's
resolved `gridCell`.
- Layer order: `node.reparent {ids?, parent, index?}` moves layers into `parent` (keeping their place
on the canvas, or taking their place in its auto layout flow) and `node.reorder {id, index}` moves
one within its parent. `index` counts the parent's children bottom first (in auto layout, the
first in the flow) and is where the (first) moved layer ends up after the move, in the same parent
or a new one; several layers land together in their stacking order. No `index`, or one past the
end, puts them on top (last in the flow).
- **Every menu action is a command** (`list_commands`), and most commands act on `ids` when given,
else on the selection. New layers become the selection.
- Colours are `"#RRGGBB"` or `"#RRGGBBAA"`. Inside fills and strokes, `color` may also be a hex