G6: 调用graph.update方法后,节点没有重新绘制

Created on 16 Sep 2020  ·  2Comments  ·  Source: antvis/G6

  • [ ] I have searched the issues of this repository and believe that this is not a duplicate.

Reproduction link

Edit on CodeSandbox

Steps to reproduce

观察两秒后节点的变化
文档中有提到update方法后会调用draw方法重绘 文档

| Environment | Info |
|---|---|
| g6 | 3.7.0 |
| System | - |
| Browser | - |

Most helpful comment

自定义节点复写 udpate 为 undefined,这样节点更新的时候才会走你复写的 drawShape 方法,否则会走被继承的父节点类型的 update 方法

G6.registerNode('name', {
  drawShape(cfg, group) {...},
  update:undefined
}, 'extendedNodeName'
)

All 2 comments

自定义节点复写 udpate 为 undefined,这样节点更新的时候才会走你复写的 drawShape 方法,否则会走被继承的父节点类型的 update 方法

G6.registerNode('name', {
  drawShape(cfg, group) {...},
  update:undefined
}, 'extendedNodeName'
)

建议完善下这部分文档,这个问题搞得脑壳疼@Yanyan-Wang

Was this page helpful?
0 / 5 - 0 ratings