1
0
mirror of synced 2025-02-21 12:29:47 +01:00

fix: Scaling on the web version

This commit is contained in:
WerWolv 2025-02-15 21:26:03 +01:00
parent 19f925c60b
commit 73a3b217a4
2 changed files with 8 additions and 3 deletions

View File

@ -648,7 +648,13 @@ namespace hex {
return std::midpoint(xScale, yScale); return std::midpoint(xScale, yScale);
} }
#elif defined(OS_WEB) #elif defined(OS_WEB)
return 1.0F; return EM_ASM_DOUBLE({
try {
return window.devicePixelRatio;
} catch (e) {
return 1.0;
}
});
#else #else
return 1.0F; return 1.0F;
#endif #endif

View File

@ -161,8 +161,7 @@ namespace hex {
const float currScaleFactor = MAIN_THREAD_EM_ASM_DOUBLE({ const float currScaleFactor = MAIN_THREAD_EM_ASM_DOUBLE({
try { try {
// Take square root of scaling to counter scaling applied by Browser return window.devicePixelRatio;
return Math.sqrt(window.devicePixelRatio);
} catch (e) { } catch (e) {
return 1.0; return 1.0;
} }