Add auto-fitting text zone option#77
Merged
Merged
Conversation
Add a per-screenshot "Text zone" to the Text tab: an optional rectangle the
headline + subheadline are confined to. When enabled, the font size is reduced
automatically so the whole text fits inside the zone — entirely, centered, and
without breaking any word across lines.
- State: textZone {enabled,x,y,width,height} in text defaults + normalization
- Rendering: computeZoneFit/maxWordWidth shrink to fit zone height and keep the
widest word on one line; drawTextToContext/textVerticalExtent confine wrap
width and center the block in the zone
- UI: toggle + X/Y/W/H sliders and a draggable/resizable dashed overlay on the
preview (DOM-only, never part of exports)
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
Adds a per-screenshot Text zone to the Text tab: an optional rectangle that the headline + subheadline are confined to. When enabled, the font size is reduced automatically so the whole text fits inside the zone — entirely, centered, and without breaking any word across lines.
What's new
Text zone (auto-fit)toggle,X / Y / W / Hsliders (% of canvas), and a draggable / resizable dashed overlay on the preview (corner handles). The overlay is a DOM element, so it is never part of the exported PNG/ZIP.Implementation
app.jstextZone {enabled, x, y, width, height}added to text defaults +normalizeTextSettings(backwards compatible; copied to panorama panels).maxWordWidth()andcomputeZoneFit()helpers;textVerticalExtent()gains a wrap-width override;drawTextToContext()confines wrap width / centre / vertical anchor when a zone is active.syncUIWithState/updateTextUIand on tab switch.index.html— zone controls + overlay markup.styles.css— styles for the controls and the dashed rectangle/handles.Verification
node --check app.jspasses.🤖 Generated with Claude Code
Generated by Claude Code