Make text zone fill the box (grow + wrap)#79
Merged
Conversation
The zone auto-fit only shrank the text, so it could stay on one line and never wrap to use the box. Now the font grows or shrinks so the wrapped block fills the zone: short text grows and wraps to fill the box, long text shrinks — always within the zone height and width, and never breaking a word across lines. - app.js: zoneFitForText searches [0.1, 6]x for the largest wrapped block that fits the zone height, capped by the widest word fitting the zone width (prevents mid-word breaks and bounds growth) - index.html: zone hint updated to "auto-size and wrap to fill the box" Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Y5pzx2vkZB8DN2dDy4YRNH
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
The text-zone auto-fit previously only shrank the text, so a headline could stay on a single line and never wrap to use the box. This makes the zone behave like a real text box: the font grows or shrinks so the wrapped block fills the zone — short text grows and wraps onto multiple lines to fill the box, long text shrinks — always within the zone's height and width, and never breaking a word across lines.
Implementation
app.js—zoneFitForTextnow searches[0.1, 6]×for the largest wrapped block that fits the zone height, then caps the scale so the widest word still fits the zone width on one line (prevents mid-word breaks and bounds growth). Combined with the existing "Same size for all languages" pass, the fill is computed for the most-constrained language and applied uniformly.index.html— zone hint updated to "auto-size and wrap to fill the box".Verification
node --check app.jspasses.🤖 Generated with Claude Code
Generated by Claude Code