impr: Prevent canvas flickering in web build

This commit is contained in:
WerWolv
2024-07-01 20:09:16 +02:00
parent 2cd8b13c1d
commit 60b81e714b
3 changed files with 7 additions and 9 deletions

View File

@@ -144,14 +144,10 @@ if (urlParams.has("lang")) {
window.addEventListener('resize', js_resizeCanvas, false);
function js_resizeCanvas() {
let canvas = document.getElementById('canvas');
canvas.top = document.documentElement.clientTop;
canvas.left = document.documentElement.clientLeft;
canvas.width = Math.min(document.documentElement.clientWidth, window.innerWidth || 0);
canvas.height = Math.min(document.documentElement.clientHeight, window.innerHeight || 0);
canvas.classList.add("canvas_full_screen")
if (GLFW.active && GLFW.active.windowPosFunc) {
getWasmTableEntry(GLFW.active.windowPosFunc)(GLFW.active.id, GLFW.active.x, GLFW.active.y);
}
GLFW.onWindowSizeChanged();
}