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

【V5】5.0.10 click-select behavior 双击节点后 选择失效 #6067

Closed
MusicTen opened this issue Jul 19, 2024 · 4 comments
Closed

【V5】5.0.10 click-select behavior 双击节点后 选择失效 #6067

MusicTen opened this issue Jul 19, 2024 · 4 comments
Assignees
Labels

Comments

@MusicTen
Copy link
Contributor

Describe the bug / 问题描述

使用 click-select 实现点击节点高亮上下游节点的效果(类似 hover-activate),但双击节点后,切换选择其他节点,高亮相邻效果失效

Reproduction link / 重现链接

https://stackblitz.com/edit/react-e7evnb?file=index.js

Steps to Reproduce the Bug or Issue / 重现步骤

  1. 点击选中节点
  2. 双击该节点
  3. 切换点击其他节点
  4. 高亮相邻效果不正常展示了

G6 Version / G6 版本

🆕 5.x

Operating System / 操作系统

macOS

Browser / 浏览器

Chrome

Additional context / 补充说明

No response

@yvonneyx yvonneyx self-assigned this Jul 19, 2024
@yvonneyx yvonneyx removed the bug label Jul 19, 2024
@yvonneyx
Copy link
Contributor

yvonneyx commented Jul 19, 2024

G6 内部管理元素状态用的是数组形式,例如,一个节点的状态可以是 states:['selected] 表示被选中,或者 states:[] 表示默认状态

当用户点击选中一个节点时,为了触发状态变化,我们需要向状态数组中添加一个状态值,一般来说 selected。如果把状态设置为 'default',会导致不改变状态数组,从而 G6 将无法检测到节点是否被选中。

如果你希望在选中节点时不改变样式,建议额外自定义一个状态,改状态样式与默认样式一致。这样即使节点被选中,样式也不会改变。

我们现在将关闭此 issue。如果您后续还有任何疑问或需要进一步的帮助,请随时重新打开它~

@MusicTen
Copy link
Contributor Author

MusicTen commented Jul 19, 2024

click-select behavior state: 'selected'应该设为不可配置。现在可配置,用户配置为非selected值后,双击后切换选择其他节点就会选中不了。或者设置的值不影响selected这个状态

@yvonneyx
Copy link
Contributor

现在是没有 'default' 状态值,其他是没问题的。你要不先试一下?

@MusicTen
Copy link
Contributor Author

设置了default状态值,双击后切换选择其他节点,click-select效果还是会失效。重现链接

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants