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.
This commit is contained in:
Hiren Kangad
2026-03-13 00:18:41 +05:30
parent 1631185e4f
commit b081ed7169
5 changed files with 37 additions and 60 deletions
+4 -10
View File
@@ -1,23 +1,17 @@
/**
* textLimits — single source of truth for font-size constraints.
* 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.
*/
// Plain text: generous range for direct manipulation
const TEXT_FONT_MIN = 6;
const TEXT_FONT_MAX = 160;
// Sticky note text: narrower range (card layout breaks at extremes)
const STICKY_FONT_MIN = 8;
const STICKY_FONT_MAX = 96;
export function clampTextFontSize(size: number): number {
return Math.round(Math.min(TEXT_FONT_MAX, Math.max(TEXT_FONT_MIN, size)));
}
export function clampStickyFontSize(size: number): number {
return Math.round(Math.min(STICKY_FONT_MAX, Math.max(STICKY_FONT_MIN, size)));
}