GeezerVison is showing github.com — Orthogonal Story: the edge connection preview not always match the final edge points · Issue #841 · maxGraph/maxGraph
Orthogonal Story: the edge connection preview not always match the final edge points #841DescriptionDescribe the bug
In some case, the edge routing points display during the connection preview are not the same as the final ones of the edge:
orthogonal_02_maxGraph.mp4
Expected behavior
The preview matches the final points of the edge, as it was implemented in mxGraph:
orthogonal_01_mxGraph_4.2.2.mp4
mxGraph resources:
Environment
maxGraph version or commit: d72c910
- Desktop or mobile: desktop
- OS and version: ubuntu 24.04
- Browser and version: Firefox 138.0.4, Chrome 136.0.7103.113
ActivityLOUISNOYEZ commented on Nov 17, 2025 Hi ! I'm interested in contributing and investigating this issue.
First I've been trying to pinpoint the precise commit that introduced the change in behavior.
Last-known mxGraph 4.2.2 fully compliant behavior (e976ab3)

The next commit chronologically 707605c (in another branch which was later merged) broke multiple aspects of the orthogonal story, which were progressively fixed in subsequent commits.
Fully broken orthogonal story
Orthogonal routing and terminal snapping invalid.

The next commit I could test where I observed a behavior change was fb7819f
Behavior change
The preview and connection now snap to a point in the upper left corner of the corresponding snap shape (which I assume to be the origin of the vertex).

Commit b2bb10e restored the orthogonal routing.
Orthogonal routing

And finally commit b51504d restored the snapping behavior of connection edges (but NOT of the preview) which brings us to the current preview and connection edge (cbfac8b) behavior.
Restored connection edge behavior (besides the missing waypoints)

Next steps for the investigation :
- Identify and track down how the preview CellState is managed by the connection handler during connection.
- Identify the relevant fix performed in b51504d and the pull request Changed the type of cell style from string to CellStyle. #82 . My current hypothesis is that some configuration that used to affect both the connection edge and the preview cellState now only affects one of them or is overriden after these systems might have been "decoupled" over the course of the commits mentionned above.
I'd like to keep track of progress over this but I don't want to pollute this issue or a pull request with incomplete solutions or notes, or is a pull request a right place for that ?
Edit 18/11/2025
Use links to publicly hosted imgur gifs. Fixed typo.
tbouffard commented on Nov 18, 2025 Hi @LOUISNOYEZ
Thanks for the 1st analysis, you are now assigned to this issue.
If this can help, I have noticed a similar buggy behavior in #840 and #894.
When it comes to tracking your progress, putting everything in this issue can be a bit tedious to read in the long run.
So, you can create a draft pull request with your findings and your work in progress implementation (the draft status is designed for that), or create a discussion in the Development category.
If you see another place in the repository, feel free to propose.
Does it make sense to you? LOUISNOYEZ commented on Nov 18, 2025 Thank you ! I actually started working on #894 initially but when I looked up which stories overrode the connection handler createEdgeState method to provide connection edge preview I thought the Orthogonal story might be easier to start with.
Incidentally these issues might be related to a erroneous perimeter handling and calculation of the center of the vertex when perimeter isn't set (see doc here and there) which could explain why the edges don't directly connect to the shape for the Fixed Points story #840 . The connection preview snapping problem also exists in the Anchor story, but is less visible because of the fixed connection points and the fact that the default perimeter if unset actually coincides with the visible shape perimeter in this example I assume.
I think a draft pull request is what I'm looking for, should I create it on my fork or directly in the maxGraph repo ? Sorry I'm kind of new to contributing on github. tbouffard commented on Nov 27, 2025 Hi, sorry for the late answer
I have seen that you created LOUISNOYEZ#1 which is fine for investigation.
When you will be done, you will have to create a new branch with your fix to be able to create a PR in the main maxGraph repository. LOUISNOYEZ commented on Mar 19, 2026 Sorry for not contributing sooner, I think I've identified the problem in the connection handler :
Commit 648e324 introduced the following changes to the updateEdgeState method of the connection handler which is responsible for the display of the connection preview :
|
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; |
|
} |
And nowadays it remains
|
if (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; |
|
} |
I believe the else clause is ran when the cursor is above a cell which can be connected to, but NOT a connection point marker. In the current code the connection preview destination defaults to coordinates 0, hence why it is at the top left of the cell shape. Restoring the delete syntax seems to restore the behavior expected from the first post. This seems to me like a minor change, although it's still somewhat unclear to me why the connection preview behaves as it does when the styles are deleted. Should I create a pull request ? tbouffard commented on Mar 23, 2026
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|