Skip to content

fix: responsive SVG root (viewBox, scales to viewport)#45

Merged
realproject7 merged 1 commit into
mainfrom
task/responsive-svg
Jun 19, 2026
Merged

fix: responsive SVG root (viewBox, scales to viewport)#45
realproject7 merged 1 commit into
mainfrom
task/responsive-svg

Conversation

@realproject7

Copy link
Copy Markdown
Owner

Output SVGs had a fixed pixel width/height and no viewBox → browsers rendered at raw size and overflowed/scrolled. Now emits a viewBox + width/height:100% + preserveAspectRatio, so it scales to any container with aspect preserved. Tests updated.

🤖 Generated with Claude Code

…g browsers

The tracer emits a fixed pixel width/height and NO viewBox, so opening the output
in a browser rendered it at raw pixel size (e.g. 2048x2048) and overflowed/scrolled.
_build_svg now emits a viewBox (derived from the source dimensions when absent),
drops the fixed px width/height, and sets style=width:100%/height:100% +
preserveAspectRatio=xMidYMid meet, so the SVG scales to any container/viewport with
aspect preserved — like professional vectorizer output. Tests updated for the new
responsive root.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@realproject7 realproject7 merged commit 73887af into main Jun 19, 2026
0 of 2 checks passed
@realproject7 realproject7 deleted the task/responsive-svg branch June 19, 2026 04:26
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.

1 participant