fix resize
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user