Files
refboard-ayon/frontend/src/canvas/textLimits.ts
T
Hiren Kangad b081ed7169 refactor(sticky): fixed-width card with S/M/L/XL/XXL font presets
Stickies are now fixed-width cards — no resize handles shown.
Text size controlled via 5 presets (10/14/18/24/32px).
On creation, zoom-aware screenToWorld snaps to nearest preset.
Height auto-adjusts from content. Plain text resize unchanged.

Removes: sticky width bake, live reflow drag, min width constraint.
Backward compatible — existing stickies map to nearest preset.
2026-03-13 00:18:41 +05:30

18 lines
558 B
TypeScript

/**
* textLimits — font-size constraints for plain text items.
*
* Used by creation defaults to keep initial sizes reasonable.
* Direct manipulation (resize-bake) intentionally bypasses these
* clamps so users can scale text to any size.
*
* Sticky notes use discrete presets (S/M/L/XL/XXL) defined in
* TextFormatToolbar.tsx — not continuous clamps.
*/
const TEXT_FONT_MIN = 6;
const TEXT_FONT_MAX = 160;
export function clampTextFontSize(size: number): number {
return Math.round(Math.min(TEXT_FONT_MAX, Math.max(TEXT_FONT_MIN, size)));
}