如何delete/remove shape? #4760
neolee6053 posted onGitHub
问题描述
我加了个shape进节点里。但如何delete/remove呢?因为这是用户可以自己加的.
G6有deleteShape/removeShape 吗?或者得控制visibility?
这是我的code,大概就是在update里,加进shape
update(cfg, node) { //@ts-ignore const update = G6.Shape.Node.circle.update.bind(this); update(cfg, node); const group = node.getContainer(); if (cfg.tag) { const nodeSize = ((Array.isArray(cfg.size) ? cfg.size[0] : cfg.size) || 15); const tagSize = nodeSize / 3; group.addShape('circle', { attrs: { x: -nodeSize / 2, y: -nodeSize / 2, r: tagSize, fill: cfg.nodeIconColor as string, lineWidth: 0.5, //stroke: '#FFFFFF', }, name: 'typeNode-tag-circle', });
graph.updateItem(n, { tag: true, nodeIcon: this.selectedIconValue, nodeIconColor : this.nodeIconColor });
重现链接
重现步骤
如上
预期行为
如上
平台
- 操作系统: [ Windows]
- 网页浏览器: [Firefox]
- G6 版本: [4.8.15]
屏幕截图或视频(可选)
No response
补充说明(可选)
No response