From 025a9c511b7dc3d4ad4cc835b5deb3dc9f34ecce Mon Sep 17 00:00:00 2001 From: Kohei Watanabe Date: Tue, 29 Dec 2020 16:42:09 +0900 Subject: [PATCH] fix: adjustRendererSize --- src/main.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main.ts b/src/main.ts index ea6f401..d55ef56 100644 --- a/src/main.ts +++ b/src/main.ts @@ -91,7 +91,8 @@ function adjustPanelSize() { } } -function adjustCanvasSize() { +function adjustRendererSize() { + renderer.setSize(window.innerWidth, window.innerHeight); camera.aspect = canvas.clientWidth / canvas.clientHeight; camera.updateProjectionMatrix(); adjustPanelSize(); @@ -103,11 +104,10 @@ function setup() { scene.clear(); scene.add(...panels); camera.position.z = 1; - adjustCanvasSize(); + adjustRendererSize(); } function main() { - renderer.setSize(window.innerWidth, window.innerHeight); Object.assign(canvas.style, { width: "100%", height: "100%" }); root.addEventListener("keydown", handleKeydown); root.addEventListener("touchstart", handleTouchmove, { passive: false }); @@ -125,7 +125,7 @@ function main() { } root.appendChild(canvas); Object.assign(root.style, { overflow: "hidden", overscrollBehavior: "none" }); - window.addEventListener("resize", adjustCanvasSize); + window.addEventListener("resize", adjustRendererSize); setup(); }