From 58b78a06d07128d858ee9dfa54602e2a71e82e23 Mon Sep 17 00:00:00 2001 From: wumail <1059037014@qq.com> Date: Wed, 13 Sep 2023 10:53:27 +0800 Subject: [PATCH] fix(extension): add group:remove-node and group:add-node event(#800) --- packages/extension/src/materials/group/GroupNode.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/extension/src/materials/group/GroupNode.ts b/packages/extension/src/materials/group/GroupNode.ts index 6e0d73890..70fbb71ef 100644 --- a/packages/extension/src/materials/group/GroupNode.ts +++ b/packages/extension/src/materials/group/GroupNode.ts @@ -114,7 +114,8 @@ class GroupNodeModel extends RectResize.model { if (nodeModel.isGroup && !nodeModel.isFolded) { // 正常情况下,parent折叠后,children应该折叠 // 因此当parent准备展开时,children的值目前肯定是折叠状态,也就是nodeModel.isFolded=true,这个代码块不会触发 - // 只有当parent准备折叠时,children目前状态才有可能是展开,即nodeModel.isFolded=false,这个代码块触发,此时isFolded=true,触发children也进行折叠 + // 只有当parent准备折叠时,children目前状态才有可能是展开, + // 即nodeModel.isFolded=false,这个代码块触发,此时isFolded=true,触发children也进行折叠 nodeModel.foldGroup(isFolded); } @@ -258,6 +259,7 @@ class GroupNodeModel extends RectResize.model { */ addChild(id) { this.children.add(id); + this.graphModel.eventCenter.emit('group:add-node', { data: this.getData() }); } /** * 删除分组子节点 @@ -265,6 +267,7 @@ class GroupNodeModel extends RectResize.model { */ removeChild(id) { this.children.delete(id); + this.graphModel.eventCenter.emit('group:remove-node', { data: this.getData() }); } getAddableOutlineStyle() { return {