GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

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 #841

New issue
Copy link
New issue
Copy link
Closed
Bug
#1025
Closed
Orthogonal Story: the edge connection preview not always match the final edge points#841
Bug
#1025
Copy link
Assignees
LOUISNOYEZ
Milestone
0.24.0

Description

@tbouffard
tbouffard
opened on May 27, 2025
Issue body actions

Describe 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:

  • source: https://github.com/jgraph/mxgraph/blob/v4.2.2/javascript/examples/orthogonal.html
  • live demo: https://jgraph.github.io/mxgraph/javascript/examples/orthogonal.html

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

Activity

  1. tbouffard
    added
    bugSomething isn't working
    triageIssue/PR under review for categorization
    on May 27, 2025
  2. tbouffard
    added a parent issue on May 27, 2025
    • Ensure that the stories work as the mxGraph examples #505
  3. tbouffard
    added the
    Bug
    issue type on May 27, 2025
  4. tbouffard
    removed
    bugSomething isn't working
    triageIssue/PR under review for categorization
    on May 27, 2025
  5. LOUISNOYEZ commented on Nov 17, 2025

    @LOUISNOYEZ
    LOUISNOYEZ
    on Nov 17, 2025
    More actions

    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)

    last fully correct

    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.

    fully broken

    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).

    behavior change

    Commit b2bb10e restored the orthogonal routing.

    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)

    restored connection edge

    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.
  6. tbouffard
    assigned
    LOUISNOYEZ
    on Nov 18, 2025
  7. tbouffard commented on Nov 18, 2025

    @tbouffard
    tbouffard
    on Nov 18, 2025
    MemberAuthor
    More actions

    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?

  8. tbouffard
    added this to the 0.22.0 milestone on Nov 18, 2025
  9. LOUISNOYEZ commented on Nov 18, 2025

    @LOUISNOYEZ
    LOUISNOYEZ
    on Nov 18, 2025
    More actions

    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.

  10. tbouffard commented on Nov 27, 2025

    @tbouffard
    tbouffard
    on Nov 27, 2025
    MemberAuthor
    More actions

    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.

  11. tbouffard
    modified the milestones: 0.22.0, 0.23.0 on Dec 11, 2025
  12. LOUISNOYEZ commented on Mar 19, 2026

    @LOUISNOYEZ
    LOUISNOYEZ
    on Mar 19, 2026
    More actions

    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 :

    maxGraph/packages/core/src/view/connection/ConnectionHandler.ts

    Lines 1497 to 1503 in 0453da2

    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

    maxGraph/packages/core/src/view/connection/ConnectionHandler.ts

    Lines 1491 to 1497 in 648e324

    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

    maxGraph/packages/core/src/view/plugin/ConnectionHandler.ts

    Lines 1310 to 1316 in 3848855

    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 ?

  13. redfish4ktc
    modified the milestones: 0.23.0, 0.24.0 on Mar 19, 2026
  14. tbouffard commented on Mar 23, 2026

    @tbouffard
    tbouffard
    on Mar 23, 2026
    MemberAuthor
    More actions

    Hi and happy to see you back 😄

    The mxGraph code was doing the property delete. I do not know why this has been changed by setting the properties to 0.
    https://github.com/jgraph/mxgraph/blob/v4.2.2/javascript/src/js/handler/mxConnectionHandler.js#L1516-L1525

    So, fell free to create a PR

  15. redfish4ktc
    closed this as completedin #1025on Apr 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @LOUISNOYEZ
    LOUISNOYEZ

Labels

No labels
No labels

Type

Bug

Projects

No projects

    Milestone

    • 0.24.0

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.