From f976988c751d8701871ee298c70402da87c133fb Mon Sep 17 00:00:00 2001 From: WerWolv Date: Sat, 25 Jan 2025 19:08:56 +0100 Subject: [PATCH] impr: Try to detect backing scaling factor on the web build --- lib/libimhex/source/api/imhex_api.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/libimhex/source/api/imhex_api.cpp b/lib/libimhex/source/api/imhex_api.cpp index aa2e33ec3..c2794699e 100644 --- a/lib/libimhex/source/api/imhex_api.cpp +++ b/lib/libimhex/source/api/imhex_api.cpp @@ -638,12 +638,13 @@ namespace hex { return std::midpoint(xScale, yScale); } #elif defined(OS_WEB) - return 1.0F; - /* - return EM_ASM_INT({ - return window.devicePixelRatio; + return MAIN_THREAD_EM_ASM_INT({ + try { + return window.devicePixelRatio; + } catch (e) { + return 1.0; + } }); - */ #else return 1.0F; #endif