Skip to content

fix(hover-activate): ignore pointer events of destroyed elements - #7691

Open
Arthur031221 wants to merge 1 commit into
antvis:v5from
Arthur031221:fix/hover-activate-destroyed-target
Open

Arthur031221 wants to merge 1 commit into
antvis:v5from
Arthur031221:fix/hover-activate-destroyed-target

Conversation

@Arthur031221

Copy link
Copy Markdown

Fixes #7588. After graph.clear() while the pointer was over an element, every later pointer move threw Unknown element type of id, and hover stopped working on the graph, including for nodes added afterwards.

clear() destroys the elements without marking them. The next pointer move makes the behavior controller emit pointerleave for the stored target, which is now destroyed. hover-activate only skipped elements marked as to be destroyed, so it asked for the state of an id that no longer exists and threw. The throw also happened before the controller moved on to the new target.

hover-activate now also ignores events whose target is destroyed. pointerleave is still emitted, so other listeners are unaffected.

Added a test in hover-activate.spec.ts that hovers a node, clears the graph and moves the pointer. Run with npx jest __tests__/unit/behaviors/hover-activate.spec.ts in packages/g6.

Assisted by Claude/Codex.

Signed-off-by: Arthur031221 <levi74108520963@gmail.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: 使用hover-activate交互,监控节点点击事件,执行graph.clear(),控制台报错,画布卡死

1 participant