diff --git a/plugin/contents/ui/dancer.html b/plugin/contents/ui/dancer.html index 536ee35..c85ce4b 100644 --- a/plugin/contents/ui/dancer.html +++ b/plugin/contents/ui/dancer.html @@ -951,8 +951,6 @@ function drawStars(ts) { } window.addEventListener('resize', resizeCanvas); -resizeCanvas(); -requestAnimationFrame(drawStars); /* ============================================================ FLOOR CANVAS — perspective grid with true vanishing point @@ -1027,8 +1025,19 @@ function drawFloor(ts) { } window.addEventListener('resize', resizeFloor); -resizeFloor(); -requestAnimationFrame(drawFloor); + +// WebEngine sometimes reports innerWidth=0 on first load — retry until valid. +function initCanvases() { + if (window.innerWidth > 0 && window.innerHeight > 0) { + resizeCanvas(); + resizeFloor(); + requestAnimationFrame(drawStars); + requestAnimationFrame(drawFloor); + } else { + setTimeout(initCanvases, 80); + } +} +initCanvases(); /* ============================================================