feat: handle window resize
This commit is contained in:
parent
49b46798b8
commit
61a461bff8
6
main.js
6
main.js
@ -239,6 +239,12 @@ function addTestPuzzle() {
|
||||
//addPieceGrid();
|
||||
addTestPuzzle();
|
||||
|
||||
window.addEventListener('resize', () => {
|
||||
camera.aspect = window.innerWidth / window.innerHeight;
|
||||
camera.updateProjectionMatrix();
|
||||
renderer.setSize(window.innerWidth, window.innerHeight);
|
||||
});
|
||||
|
||||
// Animation loop
|
||||
function animate() {
|
||||
requestAnimationFrame(animate);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user