1
0
Fork 0
mirror of https://github.com/haselkern/Minecraft-ArmorStand.git synced 2025-05-18 05:55:35 +00:00

Resize renderer on browser window resize

Fixes #39
This commit is contained in:
Lenny Lord 2022-07-16 16:39:20 +05:30
parent 4ad39b87f6
commit 66f12af03f

View file

@ -333,6 +333,17 @@ function setup(){
pointLight.position.set(0, 300, 200); pointLight.position.set(0, 300, 200);
scene.add(pointLight); scene.add(pointLight);
// Resize view
window.addEventListener("resize", () => {
width = $("#gl").width();
height = $("#gl").height();
camera.aspect = width / height;
camera.updateProjectionMatrix();
renderer.setSize(width, height);
});
} }
// Write stuff from input into variables // Write stuff from input into variables