From 144d8d8ed46c95313d3e03642859d6fae2f9620c Mon Sep 17 00:00:00 2001 From: WerWolv Date: Wed, 27 Dec 2023 22:00:09 +0100 Subject: [PATCH] web: Prevent canvas flickering when resizing browser window --- .github/workflows/build_web.yml | 2 +- dist/web/source/wasm-config.js | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_web.yml b/.github/workflows/build_web.yml index 8c400d7d1..c70adeda0 100644 --- a/.github/workflows/build_web.yml +++ b/.github/workflows/build_web.yml @@ -29,7 +29,7 @@ jobs: uses: actions/cache@v3 with: path: cache - key: ${{ runner.os }}-cmakecache-${{ hashFiles('**/CMakeLists.txt') }} + key: web-cmakecache-${{ hashFiles('**/CMakeLists.txt') }} - name: 🐳 Inject /cache into docker uses: reproducible-containers/buildkit-cache-dance@v2.1.2 diff --git a/dist/web/source/wasm-config.js b/dist/web/source/wasm-config.js index a241bda0f..8e635cd0b 100644 --- a/dist/web/source/wasm-config.js +++ b/dist/web/source/wasm-config.js @@ -73,4 +73,10 @@ function js_resizeCanvas() { 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(); } \ No newline at end of file