fix: rotated transform box, video texture crash, paste duplication, and loading UX

- TransformBox rotates with single-item selection (Figma-style), with
  handles and resize math projected into rotated coordinate space
- Fix VideoSprite alphaMode crash by swapping texture to EMPTY before
  destroying, preventing PixiJS render loop from reading null source
- Fix Ctrl+V double-paste: internal clipboard now always takes priority
  over system clipboard PNG, with wasRecentInternalPaste() guard
- Add asset loading progress bar and suppress "Drop images here" flash
  during initial scene load
This commit is contained in:
Hiren Kangad
2026-03-13 17:37:21 +05:30
parent e7e217d3d4
commit a901833b72
7 changed files with 243 additions and 70 deletions
+9 -1
View File
@@ -40,6 +40,8 @@ export interface PixiCanvasHandle {
fitAll: () => void;
getZoom: () => number;
setZoom: (zoom: number) => void;
/** True while the initial scene is being loaded (items being created). */
isSceneLoading: () => boolean;
}
export interface PixiCanvasProps {
@@ -106,6 +108,7 @@ const PixiCanvas = forwardRef<PixiCanvasHandle, PixiCanvasProps>(
const viewportRef = useRef<Viewport | null>(null);
const sceneRef = useRef<SceneManager | null>(null);
const initialLoadDone = useRef(false);
const sceneLoadingRef = useRef(false);
const spaceHeld = useRef(false);
const onChangeRef = useRef(onChange);
const [pixiReady, setPixiReady] = useState(false);
@@ -442,7 +445,11 @@ const PixiCanvas = forwardRef<PixiCanvasHandle, PixiCanvasProps>(
}
initialLoadDone.current = true;
sceneRef.current.loadScene(sceneData);
sceneLoadingRef.current = true;
sceneRef.current.loadScene(sceneData).then(() => {
sceneLoadingRef.current = false;
onChangeRef.current?.(); // trigger objectCount update
});
}, [canvasState, pixiReady]);
// ── Space key for pan mode ────────────────────────────────────────
@@ -543,6 +550,7 @@ const PixiCanvas = forwardRef<PixiCanvasHandle, PixiCanvasProps>(
ease: 'easeOutQuad',
});
},
isSceneLoading: () => sceneLoadingRef.current,
}),
[fitAll],
);