Bake Size slider zoom into saved SVG via viewBox crop

Fixkamo-internal
Shipped
March 11, 2026 at 9:03 PM UTC
Author
kamo
Commit
334fbe5

Avatar Creator's internal scale transform zooms the avatar body within the SVG canvas, but the effect is imperceptible at small display sizes (e.g. a 140x140 Avatar component). The preview was using a redundant CSS transform: scale() to show the zoom, but that CSS is never part of the saved SVG, so preview and saved always looked different. New approach: - Remove scale from avatarOptions (no Avatar Creator internal scale transform) - Add applyViewBoxZoom() which shrinks the SVG viewBox to the centre crop equivalent to CSS transform:scale(N) with overflow:hidden — this is visible at any display size and survives being saved to MinIO - Apply applyViewBoxZoom in generateAvatar so the preview SVG already reflects the correct zoom without any CSS transform - Update addBackgroundToSvg to read all four viewBox values (x, y, w, h) so the background rect is correctly positioned after a viewBox crop

All changes

Like what you see shipping?

Every one of these updates lands in your workspace automatically. Start free and watch it grow week after week.

Start Free ForeverView Pricing