GeezerVison is showing github.com — fix: restore preview edge default target position on cell hover by LOUISNOYEZ · Pull Request #1025 · maxGraph/maxGraph
Conversation
LOUISNOYEZ
commented
Mar 24, 2026
•
edited by coderabbitai
Bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
PR Checklist
- Addresses an existing open issue: closes #<the_issue_number_here>. If not, explain why (minor changes, etc.).
- You have discussed this issue with the maintainers of
maxGraph, and you are assigned to the issue.
- The scope of the PR is sufficiently narrow to be examined in a single session. A PR covering several issues must be split into separate PRs. Do not create a large PR, otherwise it cannot be reviewed and you will be asked to split it later or the PR will be closed.
- I have added tests to prove my fix is effective or my feature works. This can be done in the form of automatic tests in
packages/core/_tests_ or a new or altered Storybook story in packages/html/stories (an existing story may also demonstrate the change).
- I have provided screenshot/videos to demonstrate the change. If no releavant, explain why.
- I have added or edited necessary documentation, or no docs changes are needed.
- The PR title follows the "Conventional Commits" guidelines.
Overview
Restore connection handler mxgraph behavior.
Delete preview edge entryX and entryY style properties when hovering a cell without without hovering a specific target connection point instead of setting them to 0. Currently, the connection preview entry position snaps to the top left corner of cell shapes, which is not intended behavior.
Bug description
Demonstration using the Anchor story
- Current maxgraph behavior : The connection preview snaps to the top left of the cell shape.
connection_preview_wrong.mp4
- Intended mxgraph behavior : The connection preview snaps to the bottom center of the cell shape.
connection_preview_right.mp4
Analysis
The behavior change was introduced in commit 648e324 where the connection handler file was changed from
|
if (constraint != null && constraint.point != null) { |
|
this.edgeState.style.entryX = constraint.point.x; |
|
this.edgeState.style.entryY = constraint.point.y; |
|
} else { |
|
delete this.edgeState.style.entryX; |
|
delete this.edgeState.style.entryY; |
|
} |
to
|
if (constraint && constraint.point) { |
|
this.edgeState.style.entryX = constraint.point.x; |
|
this.edgeState.style.entryY = constraint.point.y; |
|
} else { |
|
this.edgeState.style.entryX = 0; |
|
this.edgeState.style.entryY = 0; |
|
} |
Which remains to this day. Fixing the issue consists in reverting to the original code.
Notes
- Although this pull request reverts to the initial mxgraph behavior, it provides no motivation for the initial behavior in the first place.
- I've added no tests under packages/core/__tests__ as the issue is related to a transient rendering artefact. Correctness can be assed using any story involving the connection handler where its
updateEdgeState method has not been overriden.
Keywords
closes #841
Summary by CodeRabbit
-
Bug Fixes
- Improved edge preview rendering by removing stale connection coordinate styling when preview constraints are absent, producing more accurate connection visuals.
-
Documentation
- Expanded and clarified connection-point docs: normalized entryX/entryY/exitX/exitY semantics (typical 0–1 range), how perimeter falls back to center, and how pixel offsets (entryDx/entryDy/exitDx/exitDy) apply after point computation.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
delete preview edge entryX and entryY style properties when hovering a cell without without hovering a specific target connection point.
coderabbitai
Bot
commented
Mar 24, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Walkthrough
When no connection constraint.point exists, ConnectionHandler.updateEdgeState now deletes edgeState.style.entryX and edgeState.style.entryY instead of setting them to 0. JSDoc for CellStateStyle connection-point properties was expanded and clarified.
Changes
| Cohort / File(s) |
Summary |
Edge Style Property Handling packages/core/src/view/plugin/ConnectionHandler.ts |
In updateEdgeState, remove edgeState.style.entryX and edgeState.style.entryY via delete when no constraint.point is present, replacing prior assignments of 0. |
Type / JSDoc Clarifications packages/core/src/types.ts |
Expanded and corrected JSDoc for CellStateStyle connection properties (entryX/entryY, exitX/exitY, entryDx/entryDy, exitDx/exitDy, entryPerimeter, exitPerimeter, perimeter), clarifying normalized coordinate semantics, offsets, and fallback behaviors. |
Estimated code review effort
🎯 2 (Simple) | ⏱️ ~8 minutes
Possibly related PRs
Suggested labels
enhancement
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
| Check name |
Status |
Explanation |
| Description check |
✅ Passed |
The PR description is comprehensive and complete: includes a filled checklist, clear bug description with videos, analysis of the problematic change, and references issue #841. All essential information is provided. |
| Linked Issues check |
✅ Passed |
The code changes directly address issue #841 by removing entryX/entryY property deletion and setting them to 0, restoring mxGraph behavior where the preview matches final edge points. |
| Out of Scope Changes check |
✅ Passed |
All changes are in-scope: documentation updates clarify connection-point styling properties in types.ts, and ConnectionHandler.ts changes fix the preview behavior issue described in #841. |
| Docstring Coverage |
✅ Passed |
No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. |
| Title check |
✅ Passed |
The title clearly and concisely describes the main fix: restoring the preview edge's default target position behavior on cell hover, which directly aligns with the changeset's primary objective. |
✏️ Tip: You can configure your own custom pre-merge checks in the settings.
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share
Comment @coderabbitai help to get the list of available commands and usage tips.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
ℹ️ I have been looking at the entryX/entryY properties. entryX is "The connection point in relative horizontal coordinates of an edge with its target terminal."
Setting entryX=0 and entryY=0, means that the constraint point is set to the point on the top left of the shape, which is what we previously saw.
When not setting entryX and entryY, no constraint point is used, and this is what we want to use here. See
|
const x = edge.style[source ? 'exitX' : 'entryX']; |
|
|
|
if (x !== undefined) { |
|
const y = edge.style[source ? 'exitY' : 'entryY']; |
|
|
|
if (y !== undefined) { |
|
point = new Point(x, y); |
|
} |
|
} |
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
tbouffard
changed the title
fix(connection): restore connection handler mxGraph behavior
fix: restore preview edge default target position on cell hover
Apr 28, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for this contribution and sorry for having taken so long to review it 😸
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Labels
bug
Something isn't working
Milestone
No milestone
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|