antvis/G6

[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

Yihsuan1004 posted onGitHub

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.

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 / 其他

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.

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

posted by petercat-assistant[bot] 4 months ago
posted by zhongyunWan about 2 months ago

Fund this Issue

$0.00
Funded

Pull requests