Skip to content

Conversation

@myLazyProgrammer
Copy link
Contributor

When using a custom node (in HTML/React format) with the CreateEdge interaction, if the mouse hovers over the custom node, event bubbling and event capturing will be triggered because it is an HTML component. The obtained mouse positioning data will have issues, causing the edge pointer to drift erratically.
image
So it is necessary to block the function handling during the bubbling and capturing phases.

…r nodes after adding an edge with a custom node type set to HTML.
@petercat-assistant
Copy link

Walkthrough

This pull request addresses an issue with mouse coordinates being misaligned when hovering over custom nodes in HTML/React format during the CreateEdge interaction. The fix involves blocking function handling during the event bubbling and capturing phases to prevent erratic edge pointer drift.

Changes

File Summary
packages/g6/src/behaviors/create-edge.ts Added a condition to ensure drawing only occurs during the target phase of the event, preventing unwanted behavior during bubbling and capturing phases.

@Aarebecca
Copy link
Contributor

There are two test cases that have failed, you may need to perform a fix

https://github.com/antvis/G6/actions/runs/13386208077/job/37451872733?pr=6782

@Aarebecca Aarebecca added the Outdate This issue is too old to be resolved label Apr 11, 2025
@Aarebecca
Copy link
Contributor

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request addresses an issue with mouse coordinate misalignment during edge creation on custom HTML nodes. The fix correctly restricts the drawing operation to the target phase of the event, preventing issues from event bubbling and capturing. The change is logical and effectively solves the described problem. I have one suggestion to improve code readability by replacing a magic number with a named constant.

@codecov-commenter
Copy link

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.54%. Comparing base (5ec05bd) to head (922333b).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##               v5    #6782   +/-   ##
=======================================
  Coverage   95.53%   95.54%           
=======================================
  Files         188      188           
  Lines        9907     9914    +7     
  Branches     2142     2145    +3     
=======================================
+ Hits         9465     9472    +7     
  Misses        410      410           
  Partials       32       32           
Flag Coverage Δ
g6 95.54% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
packages/g6/src/behaviors/create-edge.ts 96.84% <100.00%> (+0.03%) ⬆️
packages/g6/src/runtime/element.ts 97.16% <100.00%> (+0.02%) ⬆️
packages/g6/src/utils/data.ts 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Aarebecca Aarebecca merged commit da3a8fe into antvis:v5 Dec 1, 2025
2 checks passed
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

Successfully merging this pull request may close these issues.

3 participants