1
0
mirror of synced 2025-02-20 04:01:01 +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);
}
#elif defined(OS_WEB)
return 1.0F;
return EM_ASM_DOUBLE({
try {
return window.devicePixelRatio;
} catch (e) {
return 1.0;
}
});
#else
return 1.0F;
#endif

View File

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