Skip to content

Make text-zone auto-fit respect every language#78

Merged
flocom merged 1 commit into
mainfrom
claude/elegant-archimedes-2nh79p
Jun 21, 2026
Merged

Make text-zone auto-fit respect every language#78
flocom merged 1 commit into
mainfrom
claude/elegant-archimedes-2nh79p

Conversation

@flocom

@flocom flocom commented Jun 21, 2026

Copy link
Copy Markdown
Owner

Summary

Follow-up to #77. The text-zone auto-fit shrank each language independently, so a longer translation (e.g. German/French) could overflow the zone even when the edited language fit perfectly — the zone wasn't respected across languages.

Fix

Adds a "Same size for all languages" mode to the Text zone (on by default):

  • The font is reduced to the size that fits the most-constrained project language (the longest), then applied uniformly to all languages.
  • The text now stays inside the zone — entirely and without breaking a word — in every language, with consistent sizing.
  • Languages without text impose no constraint.
  • The toggle can be turned off to restore independent per-language fitting.

Implementation

  • app.js: split computeZoneFit into a per-language zoneFitForText + a uniform pass that takes the minimum scale over state.projectLanguages; textZone.uniform flag added to defaults + normalization; toggle wiring and UI sync.
  • index.html / styles.css: "Same size for all languages" toggle.

Verification

  • node --check app.js passes.
  • Dev server serves the updated UI (toggle present).
  • Extended standalone algorithm tests (11/11): the shared scale makes both a short (EN) and a long (DE) translation fit the zone, and equals the most-constrained language's scale.

Behaviour note: with the toggle on (default), editing a short language now shows the text at the size that fits the longest language (so possibly smaller than before) — that is what guarantees the zone is respected everywhere.

🤖 Generated with Claude Code


Generated by Claude Code

The zone auto-fit shrank each language independently, so a longer
translation could overflow the box even when the edited language fit.
Add a "Same size for all languages" mode (on by default): the font is
reduced to the size that fits the most-constrained project language and
applied uniformly, so the text stays inside the zone — entirely and
without breaking a word — in every language, with consistent sizing.

- app.js: split computeZoneFit into per-language zoneFitForText + a
  uniform pass over state.projectLanguages (min scale); textZone.uniform
  flag + normalization; toggle wiring/sync
- index.html / styles.css: "Same size for all languages" toggle

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y5pzx2vkZB8DN2dDy4YRNH
@flocom
flocom merged commit ff384ae into main Jun 21, 2026
1 check passed
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.

2 participants