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

[Bug]: When performing a second brush select, the state of the node selected in the first brush select are updated, but its styles are not reset. #6712

Open
2 of 10 tasks
Yihsuan1004 opened this issue Jan 9, 2025 · 1 comment
Labels
status: waiting for maintainer These issues have not yet been reviewed by a maintainer

Comments

@Yihsuan1004
Copy link

Describe the bug / 问题描述

When performing a second brush select, the state of the node selected in the first brush select are updated, but its styles are not reset.

Reproduction link / 复现链接

https://g6.antv.vision/api/behaviors/brush-select

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

  1. Select All nodes on the canvas.
  2. check states and node styles.
  3. Select two of the nodes.
  4. The styles of the remaining node is not reset.
    https://github.com/user-attachments/assets/9f2efadf-9660-4b13-99cd-a26c45018301

G6 Version / G6 版本

🆕 5.x

OS / 操作系统

  • macOS
  • Windows
  • Linux
  • Others / 其他

Browser / 浏览器

  • Chrome
  • Edge
  • Firefox
  • Safari (Limited support / 有限支持)
  • IE (Nonsupport / 不支持)
  • Others / 其他
@Yihsuan1004 Yihsuan1004 added the status: waiting for maintainer These issues have not yet been reviewed by a maintainer label Jan 9, 2025
Copy link

It seems like you're encountering an issue with the brush select behavior in G6 version 5.x, where the styles of nodes selected in the first brush select are not reset when performing a second brush select. This can lead to inconsistent visual states for the nodes.

To address this issue, you might want to ensure that the styles of nodes are explicitly reset when a new brush select operation is initiated. This can typically be done by listening to the brush select events and manually resetting the styles of nodes that are not part of the current selection.

Here's a general approach you can take:

  1. Listen to Brush Select Events: Ensure you have event listeners set up for the brush select behavior. This will allow you to detect when a brush select operation starts and ends.

  2. Reset Node Styles: When a new brush select operation starts, iterate over all nodes and reset their styles to the default state. This ensures that any nodes not included in the new selection have their styles reset.

  3. Apply Styles to Selected Nodes: After the brush select operation completes, apply the desired styles to the nodes that are part of the new selection.

If you need further assistance with implementing this solution or if you believe this is a bug that needs to be addressed in the library itself, please let me know, and I can help you with the next steps.

🪧 Tips For further assistance, please describe your question in the comments and @petercat-assistant to start a conversation with me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting for maintainer These issues have not yet been reviewed by a maintainer
Projects
None yet
Development

No branches or pull requests

1 participant