-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
v4.8.10 如何部分更新自定义的Node的文字shape #6079
Labels
Outdate
This issue is too old to be resolved
Comments
没太理解你的需求,请附上可以复现问题的最小案例代码 |
This issue has been closed because it has been outdate for a long time. 这个 issue 已经被关闭,因为 它已经过期很久了。 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug / 问题描述
现在自定义节点,update好像会整个全部刷新,有什么办法能只更新一个里面的text shape?我看到官网有下面这种写法,但是不适合我,我的自定义节点里有if判断,顺序是不固定的
update(cfg, node) {
const group = node.getContainer(); // 获取容器
const shape = group.get('children')[0]; // 按照添加的顺序
const style = {
path: this.getPath(cfg),
stroke: cfg.color,
};
shape.attr(style); // 更新属性
// 更新文本的逻辑类似,但是需要考虑 cfg.label 是否存在的问题
// 通过 label.attr() 更新文本属性即可
},
Reproduction link / 重现链接
No response
Steps to Reproduce the Bug or Issue / 重现步骤
No response
G6 Version / G6 版本
4.x
Operating System / 操作系统
macOS, Windows
Browser / 浏览器
Chrome
Additional context / 补充说明
No response
The text was updated successfully, but these errors were encountered: