fix: drag mind map root node should layout in real time (#9252)

Fixes [BS-2062](https://linear.app/affine-design/issue/BS-2062/拖拽整个-mind-map-还是希望和之前一样,整个思维导图跟手)
This commit is contained in:
doouding
2024-12-23 10:33:56 +00:00
parent aacdb71ee2
commit b246a2d45f
7 changed files with 533 additions and 109 deletions
@@ -624,6 +624,15 @@ export class MindmapElementModel extends GfxGroupLikeElementModel<MindmapElement
return this._nodeMap.get(id) ?? null;
}
getNodeByPath(path: number[]): MindmapNode | null {
let node: MindmapNode | null = this._tree;
for (let i = 1; i < path.length; i++) {
node = node?.children[path[i]];
if (!node) return null;
}
return node;
}
getParentNode(id: string) {
const node = this.children.get(id);