mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-02 08:28:18 +00:00
Two unrelated noise sources after wiring the editor into the webapp: 1. FontLoader was fetching /resources/fonts/CarterOneRegular.json, which exists in the Tauri public/ but not in the webapp's. Vite's SPA fallback returns index.html (200, HTML body), the FontLoader's progress callback fires "Font Loaded: 1" three times as it streams, then JSON.parse chokes on the leading `<` — surfaces as an unhandled promise rejection from LoadingPlaceHolderManager. Copy the same font asset into the webapp's public/ tree (same pattern Tauri and editor3d already use). 2. Editor.initialize() reads sceneContainerEl.offsetWidth/offsetHeight to size the WebGLRenderer + post-processing pipeline. On the webapp the flex chain (SidebarInset → wrapper → SceneContainer) isn't always laid out by first call, so the dimensions are transiently 0×0. setSize(0,0) then configureMain(0,0) allocates six post-process framebuffer attachments at 0 size, each emitting INVALID_FRAMEBUFFER_OPERATION until the next window.resize event cascades through and resizes them properly. Clamp the initial container offset to ≥1 (Math.max(1, ...)) and replace the `?? 0` fallbacks on the canvas dimensions with `|| 1`. First frame renders into a harmless 1×1, next resize fixes everything.