feat(router): add minMargin option to rightAngle router to suppress margin-overlap detours#3266
Open
Geliogabalus wants to merge 19 commits intoclientIO:masterfrom
Open
feat(router): add minMargin option to rightAngle router to suppress margin-overlap detours#3266Geliogabalus wants to merge 19 commits intoclientIO:masterfrom
Geliogabalus wants to merge 19 commits intoclientIO:masterfrom
Conversation
There was a problem hiding this comment.
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
minMarginoption torightAngleRouterand thread it through allrouteBetweenPointscalls. - Add “ignore overlapping margin” logic in
routeBetweenPointsfor opposite-side routing cases. - Add a new
examples/right-angle-playground-jsworkspace 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.
kumilingus
previously approved these changes
Apr 14, 2026
# Conflicts: # packages/joint-core/types/joint.d.ts
# Conflicts: # packages/joint-core/src/routers/rightAngle.mjs # packages/joint-core/test/jointjs/routers.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
minMarginoption torightAngleRouter(TypeScript type included)resolveForTopSourceSide,resolveForBottomSourceSide,resolveForLeftSourceSide, andresolveForRightSourceSidefrom short (smx0,smy1, …) to descriptive names (sMarginX0,sMarginY1, …) for readabilityrouteBetweenPoints, derive tighter routing boundaries usingminMargin:minSourceMargin = Math.min(minMargin, sourceMargin)(falls back tosourceMarginwhenminMarginisnull)sMinMarginX0/X1/Y0/Y1andtMinMarginX0/X1/Y0/Y1are used in place of full-margin boundaries in the facing-anchor and overlap routing branches, allowing routes to pass closer to elements whenminMarginis setminMarginto everyrouteBetweenPointscall site throughoutrightAngleRouterright-angle-playground-jsexample demonstrating the option with movable vertices, anchors, and a resize handleTest plan
sMinMarginX0/X1boundaries are respected in the left→right and right→left facing-anchor routing branches whenminMarginis setminMargin(defaultnull) preserves existing routing behaviour in all side combinationsright-angle-playground-jsexample loads and the router respects theminMargin: 10setting when elements are dragged close together🤖 Generated with Claude Code