Hero editor: scale text-block fonts with the resize handle (#25) #26
Reference in New Issue
Block a user
No description provided.
Delete Branch "enhancement/hero"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Fixes #25. Makes the Hero editor's text-box resize handle scale the text so editing is WYSIWYG and comfortable.
Previously the
text_blockcorner handle only changed the wrap width — font sizes never tracked the box, so dragging it bigger/smaller left the type the same size. Now the handle acts as a proportional zoom: dragging scales every line's font together, preserving the h1/h2/p size ratios and keeping each line's manually-set baseline.Changes
scaleFontSize(v, ratio)helper — numeric px sizes (floored at 6px so text never disappears) and simplerem/em/pxstrings scale by the box ratio; responsive strings likeclamp()/vw(the default hero heading) are left untouched so they keep adapting to the viewport.text_block, the drag snapshots the starting width + lines and computesratio = newWidth / baseWidthagainst the drag origin (no rounding drift mid-drag), then updates the box width and all line fonts together. Multiplying every line by the same ratio preserves the relative sizing.Only
HeroEditor.jsxchanges —HeroElement.jsxalready renders whateverfontSizeit's given (number or string), so no change was needed there.Behavior notes
Verification
clamp()preserved, 6px floor).npm run buildpasses.🤖 Generated with Claude Code