fix: mirror shape rotation and connector geometry in SVG thumbnails/exports - #591
Merged
vibhavkatre merged 5 commits intoSep 1, 2026
Merged
Conversation
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains. Reviews (5): Last reviewed commit: "fix: normalize attached endpoint and elb..." | Re-trigger Greptile |
vibhavkatre
approved these changes
Sep 1, 2026
vibhavkatre
left a comment
Collaborator
There was a problem hiding this comment.
This closes a genuine gap: the export was drawing every connector as a straight grey line between two shape centres, so a diagram with elbows, arrowheads or a routed flowchart looked nothing like the canvas in a thumbnail, a PNG or a PDF.
I checked the parts that had to match the canvas exactly, and they do:
endpointPointnow usesanchorPoint(shape, endpoint.anchor || 'right')— the same expression, including the'right'default, thatConnectorView.vue'sresolveuses. The centre approximation was the source of most of the divergence.- The mind-map branch path goes through
branchPathPoints(a, b), which is what the canvas draws (ConnectorView.vue:109) despite the name suggesting it returns points rather than adstring. - The branch stroke colour mirrors
strokeColor— the child's border colour, falling back to#525252. elbowPathreproduces the canvas version exactly: same 14-unit clamp, samer > 0.5guard, same three-leg construction.escapeAttr/safeColor/numare applied on the new attributes, and the id used for the markerurl(#…)is stripped to[A-Za-z0-9_-]. The XSS matrix picking upblock shape rotationandconnector idis the right instinct — that table is the reason a persisted value cannot close an attribute here.
Two follow-ups rather than blockers:
elbowPathnow exists twice — here andConnectorView.vue:118— and #598 adds a third inline copy. Once that lands, moving it intosrc/diagram/and importing it in both places would stop the three drifting apart. Same argument for the marker shapes, which duplicateConnectorMarker.vue.- The
<defs>block is emitted per connector, so a large diagram repeats identical marker definitions. Correct, just wasteful; a single hoisted<defs>keyed by colour and type would be tidier if export size ever matters.
I have asked #598 to rebase onto this and add midX to the elbow branch here, since this version hardcodes the midpoint.
Merging.
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.
Closes #572
What changed
useThumbnail.jsto correctly apply shape rotation and flip transformations to the entire shape group (body + text).<line>fallback for block connectors inuseThumbnail.jswith a comprehensive SVG<path>builder.anchorPointfrom@/diagram/geometry.jsto resolve endpoints to their correct anchor positions rather than using shape centers as a cheap approximation.Why it matters
This ensures that the minimap, saved thumbnails, and exported images (PNG, PDF, SVG) match the live canvas rendering exactly, correcting issues where shape rotation was ignored and connector paths/arrowheads differed from the live editor.
Verified