Skip to content

Commit

Permalink
fix(extension): add group:remove-node and group:add-node event(#800)
Browse files Browse the repository at this point in the history
  • Loading branch information
wumail authored and boyongjiong committed Sep 19, 2023
1 parent 99f0f4b commit 58b78a0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/extension/src/materials/group/GroupNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down Expand Up @@ -258,13 +259,15 @@ class GroupNodeModel extends RectResize.model {
*/
addChild(id) {
this.children.add(id);
this.graphModel.eventCenter.emit('group:add-node', { data: this.getData() });
}
/**
* 删除分组子节点
* @param id 节点id
*/
removeChild(id) {
this.children.delete(id);
this.graphModel.eventCenter.emit('group:remove-node', { data: this.getData() });
}
getAddableOutlineStyle() {
return {
Expand Down

0 comments on commit 58b78a0

Please sign in to comment.