Skip to content
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

Closed
CoolRice opened this issue Jul 24, 2024 · 2 comments
Closed

v4.8.10 如何部分更新自定义的Node的文字shape #6079

CoolRice opened this issue Jul 24, 2024 · 2 comments
Labels
Outdate This issue is too old to be resolved

Comments

@CoolRice
Copy link

CoolRice commented Jul 24, 2024

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

@yvonneyx
Copy link
Contributor

没太理解你的需求,请附上可以复现问题的最小案例代码

@Aarebecca Aarebecca added the Outdate This issue is too old to be resolved label Aug 9, 2024
Copy link

github-actions bot commented Aug 9, 2024

This issue has been closed because it has been outdate for a long time.
Please open a new issue if you still need help.

这个 issue 已经被关闭,因为 它已经过期很久了
如果你仍然需要帮助,请创建一个新的 issue。

@github-actions github-actions bot closed this as completed Aug 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Outdate This issue is too old to be resolved
Projects
None yet
Development

No branches or pull requests

3 participants