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 — fix: restore preview edge default target position on cell hover by LOUISNOYEZ · Pull Request #1025 · maxGraph/maxGraph

Conversation

@LOUISNOYEZ

@LOUISNOYEZ LOUISNOYEZ commented Mar 24, 2026 •
edited by coderabbitai Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

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

  • This pull request is intended to fix issue Orthogonal Story: the edge connection preview not always match the final edge points #841 and other issues involving misposition of the connection preview when using the connection handler.

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

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;
}

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.

All reactions
@LOUISNOYEZ
fix: restore connection handler mxGraph behavior
a8dbc41
delete preview edge entryX and entryY style properties when hovering a cell without without hovering a specific target connection point.
@coderabbitai

coderabbitai Bot commented Mar 24, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

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

  • feat: accept more nullish parameter in various methods  #892 — Modifies ConnectionHandler.updateEdgeState and related handling of entryX/entryY, addressing similar edge preview/entry coordinate behavior.

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
  • X
  • Mastodon
  • Reddit
  • LinkedIn

Comment @coderabbitai help to get the list of available commands and usage tips.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@LOUISNOYEZ
LOUISNOYEZ marked this pull request as ready for review March 24, 2026 11:22
@tbouffard

tbouffard commented Mar 25, 2026

Copy link
Copy Markdown
Member

ℹ️ 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

maxGraph/packages/core/src/view/mixin/ConnectionsMixin.ts

Lines 160 to 168 in 24357a7

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);
}
}

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

redfish4ktc added 2 commits March 25, 2026 15:43
@redfish4ktc
CellStateStyle: improve JSDoc (entryX, entryY)
c37947a
@redfish4ktc
CellStateStyle: improve JSDoc for entry and exit properties
8de4221
@sonarqubecloud

sonarqubecloud Bot commented Mar 26, 2026

Copy link
Copy Markdown

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarQube Cloud

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@tbouffard tbouffard changed the title fix(connection): restore connection handler mxGraph behavior fix: restore preview edge default target position on cell hover Apr 28, 2026
redfish4ktc
redfish4ktc approved these changes Apr 28, 2026
View reviewed changes

@redfish4ktc redfish4ktc left a comment

Copy link
Copy Markdown
Member

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.

All reactions
@redfish4ktc
redfish4ktc merged commit fc7aa28 into maxGraph:main Apr 28, 2026
9 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@tbouffard tbouffard added the bug Something isn't working label Aug 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@redfish4ktc redfish4ktc redfish4ktc approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

bug Something isn't working

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Orthogonal Story: the edge connection preview not always match the final edge points

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@LOUISNOYEZ @tbouffard @redfish4ktc
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.
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.