diff --git a/dist/web/source/wasm-config.js b/dist/web/source/wasm-config.js index 00dcba1d2..0d219fc8c 100644 --- a/dist/web/source/wasm-config.js +++ b/dist/web/source/wasm-config.js @@ -271,11 +271,11 @@ 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.top = canvas.parentElement.clientTop; + canvas.left = canvas.parentElement.clientLeft; - let width = Math.min(document.documentElement.clientWidth, window.innerWidth || 0); - let height = Math.min(document.documentElement.clientHeight, window.innerHeight || 0); + let width = Math.min(canvas.parentElement.clientWidth, window.innerWidth || 0); + let height = Math.min(canvas.parentElement.clientHeight, window.innerHeight || 0); canvas.style.width = width + "px"; canvas.style.height = height + "px"; diff --git a/main/gui/CMakeLists.txt b/main/gui/CMakeLists.txt index e746f8f5b..c53b77ef5 100644 --- a/main/gui/CMakeLists.txt +++ b/main/gui/CMakeLists.txt @@ -45,6 +45,7 @@ if (EMSCRIPTEN) target_link_options(main PRIVATE -sEXPORTED_RUNTIME_METHODS=ccall) target_link_options(main PRIVATE -sFETCH) target_link_options(main PRIVATE -sASSERTIONS) + target_link_options(main PRIVATE -sNO_DISABLE_EXCEPTION_CATCHING) target_link_options(main PRIVATE -sWASM_BIGINT) target_link_options(main PRIVATE -O2) target_link_options(main PRIVATE -fsanitize=null) diff --git a/main/gui/source/window/platform/web.cpp b/main/gui/source/window/platform/web.cpp index e0b213bb0..552bf6d93 100644 --- a/main/gui/source/window/platform/web.cpp +++ b/main/gui/source/window/platform/web.cpp @@ -147,6 +147,7 @@ namespace hex { prevWidth = width; prevHeight = height; this->resize(width, height); + resizeCanvas(); } } @@ -167,7 +168,7 @@ namespace hex { ImHexApi::System::impl::setNativeScale(currScaleFactor); ThemeManager::reapplyCurrentTheme(); - ImGui::GetStyle().ScaleAllSizes(currScaleFactor); + ImGui::GetStyle().ScaleAllSizes(currScaleFactor / prevScaleFactor); } prevScaleFactor = currScaleFactor;