Fix centering of graphics with zero-width or zero-height bounds - #233
Open
gaboolthewild wants to merge 1 commit into
Open
gaboolthewild wants to merge 1 commit into
gaboolthewild wants to merge 1 commit into
Conversation
Compute SVG and canvas/PNG centers from the actual bounds while retaining safe fallback spans for scaling. Add regression coverage for points and axis-aligned lines. Implemented and tested with OpenAI Codex assistance.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Author
|
Could you confirm whether this fix, if merged, will be picked up by the contribution tracker, and whether any contributor onboarding is needed beyond GitHub Sponsors enrollment? I understand this PR has no fixed bounty and sponsorship depends on the assessed contribution score. |
This branch was successfully deployed
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.
Single points and axis-aligned lines are shifted away from the output center in SVG, canvas, and PNG rendering. The transforms replace a zero-sized span with 1 to avoid division by zero, then incorrectly use that fallback span when computing the center.
This change computes the center from the actual bounds while preserving the existing scale fallback. It fixes both the SVG transform and the shared canvas/PNG transform.
Validation:
AI assistance: implemented and tested with OpenAI Codex.