{{ message }}
fix(ConnectorShape): ignore unset arrows in edge bounding box#1094
Merged
tbouffard merged 1 commit intoJun 22, 2026
Merged
Conversation
…ingBox Default an absent startArrow/endArrow to NONE before comparing, so an unset arrow no longer enlarges the bounding box. The strict `this.style.startArrow !== NONE` check evaluated `undefined !== 'none'` as true, running the branch for arrows that were never set and growing the box by an extra marker size per side. This shrank the computed graph bounds and the fit scale slightly compared to mxGraph. mxGraph mxConnector.augmentBoundingBox reads arrows via getValue(style, ARROW, NONE), which defaults absent keys to NONE. The fix mirrors that with `(this.style.startArrow ?? NONE) !== NONE`, also aligning with createMarker in the same file which already defaults the arrow type to NONE. Add data-driven tests on augmentBoundingBox covering: only end arrow set, only start arrow set, no arrow set, explicit none on both sides, and both arrows set.
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.




PR Checklist
maxGraph, and you are assigned to the issue.Overview
ConnectorShape.augmentBoundingBoxtreated an unsetstartArrow/endArrowas present, so an edge with no arrow on a side still grew its bounding box by an extra marker size on that side.The check was a strict comparison against
NONE:When the style does not define the arrow,
this.style.startArrowisundefined, andundefined !== 'none'istrue, so the branch runs for arrows that were never set. This grows the bounding box (and therefore the graph bounds and the computed fit scale) more than it should.This is a porting regression from mxGraph.
mxConnector.augmentBoundingBoxreads the arrow withgetValue(style, ARROW, NONE), which defaults an absent key toNONE, so the branch is correctly skipped.The fix defaults the value before comparing, mirroring mxGraph and aligning with
createMarkerin the same file which already uses... || NONE:Tests: data-driven coverage was added on
augmentBoundingBoxfor the cases only end arrow set, only start arrow set, no arrow set, explicitnoneon both sides, and both arrows set. The first three were red before the fix.Notes
While investigating this, it became clear that the mxGraph to maxGraph migration introduced regressions in several places where a style default value is not handled the way mxGraph handled it (mxGraph systematically went through
getValue(style, KEY, default), whereas maxGraph sometimes reads the property directly and compares it without applying the default). Several such cases have already been fixed individually, but we will need to conduct a general investigation to systematically compare the default values used in mxGraph and maxGraph, to catch the remaining occurrences rather than fixing them one by one as they are discovered.Summary by CodeRabbit
Bug Fixes
Tests