fix resize

This commit is contained in:
2026-02-18 07:20:40 -08:00
parent 7882a92059
commit 89386f12a0
4 changed files with 19 additions and 11 deletions

View File

@@ -13,16 +13,15 @@
}
html,
body {
margin: 0; /* remove default margin */
height: 100%; /* make body fill the browser window */
display: flex;
place-content: center center;
margin: 0px;
width: 100%;
height: 100%;
overflow: hidden;
}
canvas {
width: 600px;
height: 600px;
max-width: 100%;
display: block;
margin: 0;
width: 100%;
height: 100%;
}
</style>
<script defer src="player.js" type="module"></script>

View File

@@ -34,3 +34,11 @@ function animate(now) {
}
requestAnimationFrame(animate);
function resize() {
canvas.width = canvas.clientWidth;
canvas.height = canvas.clientHeight;
graphics.resize(canvas.width, canvas.height);
}
window.addEventListener("resize", resize);
resize();