Skip to content

Wires story: Edge preview from/to edge has incorrect terminal points #894

@tbouffard

Description

@tbouffard

Describe the bug

When creating an edge from or to another edge, the preview shows incorrect terminal points:

  • The start point is always fixed to one end of the edge, instead of matching the click position
  • The end point also snaps to an endpoint, instead of following the cursor

Once the edge is finalized, the points are correct. But during the preview, the edge shape is misleading and seems to "jump" between preview and final rendering.

✅ No issue when connecting from/to vertices
❌ Problem only occurs when connecting from/to edges

This is very similar to what was reported in #841

To Reproduce

  1. Start creating an edge from an existing edge
  2. Drag toward another edge and observe the preview
  3. Preview doesn’t follow the cursor and sticks to edge endpoints
  4. Release → edge is created with correct geometry

Expected behavior

The preview should reflect the final geometry:

  • Start point should match where the user clicked on the edge
  • Target point should follow the mouse cursor, even when hovering an edge

Screenshots

Problem in maxGraph

maxgraph_pr-893_edge_wrong_points_while_creating.mp4

This was working in mxGraph 4.2.2. See https://jgraph.github.io/mxgraph/javascript/examples/wires.html

mxGraph_wires_example_working_edge_preview.mp4

Environment

  • maxGraph version or commit:
  • OS and version: Ubuntu 24.04
  • Browser and version:
    • Chrome 138.0.7204.183
    • Firefox 141.0
  • Node/npm version: -
  • Used frameworks (if applicable): -

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions