feat(sticky): proportional card width per text size preset

Each S/M/L/XL/XXL preset now sets both fontSize and card width:
S(20px/200w), M(28px/260w), L(36px/320w), XL(48px/400w), XXL(60px/480w).

Creation picks preset based on zoom, toolbar toggle updates both.
Wider size toggle buttons for XL/XXL labels, font name maxWidth 110px.
Backward compatible — existing stickies keep original width.
This commit is contained in:
Hiren Kangad
2026-03-13 00:26:09 +05:30
parent b081ed7169
commit 706b00cf35
3 changed files with 26 additions and 16 deletions
+3 -1
View File
@@ -20,7 +20,7 @@ import UserCursors from '../components/UserCursors';
import ContextMenu from '../components/ContextMenu';
import LayerPanel from '../components/LayerPanel';
import SelectionToolbar from '../components/SelectionToolbar';
import TextFormatToolbar from '../components/TextFormatToolbar';
import TextFormatToolbar, { getStickyWidthForSize } from '../components/TextFormatToolbar';
import VideoControls from '../components/VideoControls';
import ShortcutsHelp from '../components/ShortcutsHelp';
import MattermostImport from '../components/MattermostImport';
@@ -975,9 +975,11 @@ export default function Editor({ isPublicView }: EditorProps) {
} : undefined}
onStickySizeChange={textToolbar.kind === 'sticky' ? (fontSize) => {
const scene = canvasRef.current?.getScene();
const newWidth = getStickyWidthForSize(fontSize);
for (const item of textToolbar.items) {
const d = item.data as StickyObject;
d.fontSize = fontSize;
d.w = newWidth;
if (item.displayObject instanceof StickySprite) {
item.displayObject.updateFromData(d);
d.h = item.displayObject.computedHeight;