Skip to content

feat(router): add minMargin option to rightAngle router to suppress margin-overlap detours#3266

Draft
Geliogabalus wants to merge 8 commits intoclientIO:masterfrom
Geliogabalus:right-angle-fix
Draft

feat(router): add minMargin option to rightAngle router to suppress margin-overlap detours#3266
Geliogabalus wants to merge 8 commits intoclientIO:masterfrom
Geliogabalus:right-angle-fix

Conversation

@Geliogabalus
Copy link
Copy Markdown
Contributor

@Geliogabalus Geliogabalus commented Apr 7, 2026

Summary

  • Introduce a minMargin option to rightAngleRouter
  • Pass minMargin through to every routeBetweenPoints call (all four anchor-side combinations: top→bottom, bottom→top, left→right, right→left)
  • Inside routeBetweenPoints, derive ignoreOverlappingMargin = (sourceMargin + targetMargin) - 2 * minMargin — when the margin zones of two adjacent elements overlap by at most this threshold the router skips the detour-around-margin logic and routes directly between the anchors
  • Add a right-angle-playground-js example that demonstrates the option in action

Test plan

  • Verify that links between horizontally adjacent elements (left/right anchors) no longer detour around margin zones when minMargin is set and the margin overlap is within the threshold
  • Verify the same for vertically adjacent elements (top/bottom anchors)
  • Verify that routes still correctly route around margin zones when the overlap exceeds the threshold
  • Verify that omitting minMargin (default null) preserves existing routing behaviour

🤖 Generated with Claude Code

@Geliogabalus Geliogabalus changed the title fix(router): add ignoreOverlappingMargin support to all routeBetweenPoints combinations fix(dia): correct bounding rect measurement for HTML element magnets Apr 8, 2026
@Geliogabalus Geliogabalus changed the title fix(dia): correct bounding rect measurement for HTML element magnets fix(router): add ignoreOverlappingMargin support to all routeBetweenPoints combinations Apr 8, 2026
@Geliogabalus Geliogabalus changed the title fix(router): add ignoreOverlappingMargin support to all routeBetweenPoints combinations fix(router): add minMargin option to rightAngle router to suppress margin-overlap detours Apr 11, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new minMargin option to the rightAngle router to reduce unnecessary “detour around margin” routes when elements are adjacent and their margin zones only minimally overlap, and introduces a new JS playground example to demonstrate the behavior.

Changes:

  • Add minMargin option to rightAngleRouter and thread it through all routeBetweenPoints calls.
  • Add “ignore overlapping margin” logic in routeBetweenPoints for opposite-side routing cases.
  • Add a new examples/right-angle-playground-js workspace demo (and lockfile entry).

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
yarn.lock Adds the new @joint/demo-right-angle-playground-js workspace entry.
packages/joint-core/src/routers/rightAngle.mjs Implements minMargin option and new margin-overlap suppression logic.
examples/right-angle-playground-js/src/styles.css Styling for the new playground demo.
examples/right-angle-playground-js/src/main.js Demo setup showcasing rightAngle routing with minMargin.
examples/right-angle-playground-js/package.json Declares the new example workspace package and its scripts/deps.
examples/right-angle-playground-js/index.html HTML entrypoint for the new Vite demo.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/joint-core/src/routers/rightAngle.mjs Outdated
Comment thread packages/joint-core/src/routers/rightAngle.mjs
Comment thread packages/joint-core/src/routers/rightAngle.mjs
Comment thread packages/joint-core/src/routers/rightAngle.mjs
Comment thread packages/joint-core/types/joint.d.ts Outdated
kumilingus
kumilingus previously approved these changes Apr 14, 2026
@kumilingus kumilingus self-requested a review April 14, 2026 10:47
@kumilingus kumilingus dismissed their stale review April 14, 2026 10:48

misclick

@kumilingus kumilingus changed the title fix(router): add minMargin option to rightAngle router to suppress margin-overlap detours feat(router): add minMargin option to rightAngle router to suppress margin-overlap detours Apr 14, 2026
@Geliogabalus Geliogabalus marked this pull request as draft April 15, 2026 08:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants