perf(sticky): remove creation delay + add dirty-checking to StickySprite

- Replace 50ms setTimeout with queueMicrotask for editor open
- Skip updateFromData() entirely when no inputs changed
- Cache background redraw inputs, skip Graphics clear+redraw when shape unchanged
- Separate text-only, style-only, and bg-only update paths
This commit is contained in:
Hiren Kangad
2026-03-12 22:09:12 +05:30
parent 565b7c6c19
commit f12b75395a
2 changed files with 106 additions and 22 deletions
+3 -2
View File
@@ -348,7 +348,8 @@ export function activateTool(
const canvasEl = container.querySelector('canvas');
const domContainer = canvasEl?.parentElement ?? container;
setTimeout(() => {
// Use microtask instead of 50ms delay — PixiJS only needs one tick
queueMicrotask(() => {
ctx.textEditor!.startEditing(item, viewport, domContainer, () => {
// Cleanup rule — fires on BOTH save and cancel (stopEditing always calls _onChange):
// - new sticky + cancel/blur with empty text => remove (no blank notes left behind)
@@ -362,7 +363,7 @@ export function activateTool(
ctx.onChange();
});
ctx.textEditor!.clearText();
}, 50);
});
}
ctx.switchToSelect?.();