---
{
  "id": "platform.mindmap.ordering-and-layout",
  "topic": "mindmap",
  "title": "Mindmap 排序 anchors 與 layout",
  "locale": "zh-TW",
  "version": "2026-08-09",
  "summary": "Forest 排序使用 sibling anchors 與 server-owned sort keys，而每個 root 都是獨立樹的畫布 anchor。",
  "content": "`move_node` 沒有 public index、position 或 `sortKey`。在 `newParentId` 下用 anchors 定位：`beforeNodeId` 表示緊接其後，`afterNodeId` 表示緊鄰其前。兩者同時提供時 siblings 必須相鄰；錯誤 parent 的 anchor 會 conflict；全省略則 append。Roots 共用 null-parent sibling band，獨立 root 建立或 detach 也 append 於此。\n\n`sortKey` 是 server 管理的 20 位零填充數字字串，不得傳入。Rank 太密或異常時會 rebalance；response 的 `siblingSortKeys` 應覆蓋 client cache。`get_mindmap` 依 parent、`sortKey`、created time 排序。\n\n每棵樹獨立 layout。Root anchor 是 `manualOffset`，null 為原點；非 root offset 仍相對且沿 descendants 級聯。`layoutSide` 僅接受 `auto`、`left`、`right`，只適用於該 root 的 direct children；deep create 帶 side 會 invalid，搬到非 root 下會清除。`manualOffset` 的 finite components 必須介於 -100,000 與 100,000；null 清除。Detach 傳絕對 offset 並清 side；attach 傳 null 回自動 layout。Promote-delete Action 不能提供 child anchors，因此 root children 使用垂直 fallback；只有 v1 REST surface 接受明確 child anchors。Undo 會清除 promoted-root offsets。\n\nReparent 會先用 per-Mindmap server lock 序列化，再檢查 cycle 與 anchors。Client 不需自行加鎖；遇到 conflict 時，先重讀目前 forest 與 anchors，再判斷是否重試。\n",
  "aliases": [
    "節點重排",
    "sibling anchors",
    "layout side",
    "manual offset",
    "sort key"
  ],
  "tags": [
    "mindmap",
    "ordering",
    "layout",
    "forest"
  ],
  "relatedActions": [
    "arinova.mindmap.get_mindmap",
    "arinova.mindmap.add_node",
    "arinova.mindmap.update_node",
    "arinova.mindmap.move_node",
    "arinova.mindmap.delete_node_promote_children"
  ],
  "relatedActionPrefixes": [],
  "url": "https://docs.arinova.ai/zh-tw/kb/mindmap/ordering-and-layout/"
}
---

`move_node` 沒有 public index、position 或 `sortKey`。在 `newParentId` 下用 anchors 定位：`beforeNodeId` 表示緊接其後，`afterNodeId` 表示緊鄰其前。兩者同時提供時 siblings 必須相鄰；錯誤 parent 的 anchor 會 conflict；全省略則 append。Roots 共用 null-parent sibling band，獨立 root 建立或 detach 也 append 於此。

`sortKey` 是 server 管理的 20 位零填充數字字串，不得傳入。Rank 太密或異常時會 rebalance；response 的 `siblingSortKeys` 應覆蓋 client cache。`get_mindmap` 依 parent、`sortKey`、created time 排序。

每棵樹獨立 layout。Root anchor 是 `manualOffset`，null 為原點；非 root offset 仍相對且沿 descendants 級聯。`layoutSide` 僅接受 `auto`、`left`、`right`，只適用於該 root 的 direct children；deep create 帶 side 會 invalid，搬到非 root 下會清除。`manualOffset` 的 finite components 必須介於 -100,000 與 100,000；null 清除。Detach 傳絕對 offset 並清 side；attach 傳 null 回自動 layout。Promote-delete Action 不能提供 child anchors，因此 root children 使用垂直 fallback；只有 v1 REST surface 接受明確 child anchors。Undo 會清除 promoted-root offsets。

Reparent 會先用 per-Mindmap server lock 序列化，再檢查 cycle 與 anchors。Client 不需自行加鎖；遇到 conflict 時，先重讀目前 forest 與 anchors，再判斷是否重試。
