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();
|
//addPieceGrid();
|
||||||
addTestPuzzle();
|
addTestPuzzle();
|
||||||
|
|
||||||
|
window.addEventListener('resize', () => {
|
||||||
|
camera.aspect = window.innerWidth / window.innerHeight;
|
||||||
|
camera.updateProjectionMatrix();
|
||||||
|
renderer.setSize(window.innerWidth, window.innerHeight);
|
||||||
|
});
|
||||||
|
|
||||||
// Animation loop
|
// Animation loop
|
||||||
function animate() {
|
function animate() {
|
||||||
requestAnimationFrame(animate);
|
requestAnimationFrame(animate);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user