web: Fix canvas being too big

This commit is contained in:
WerWolv
2025-12-30 18:28:26 +01:00
parent 42da24e31d
commit 89dea86b3b
2 changed files with 8 additions and 6 deletions

View File

@@ -271,8 +271,14 @@ function js_resizeCanvas() {
canvas.top = document.documentElement.clientTop; canvas.top = document.documentElement.clientTop;
canvas.left = document.documentElement.clientLeft; canvas.left = document.documentElement.clientLeft;
canvas.width = Math.min(document.documentElement.clientWidth, window.innerWidth || 0) * window.devicePixelRatio;
canvas.height = Math.min(document.documentElement.clientHeight, window.innerHeight || 0) * window.devicePixelRatio; let width = Math.min(document.documentElement.clientWidth, window.innerWidth || 0);
let height = Math.min(document.documentElement.clientHeight, window.innerHeight || 0);
canvas.style.width = width + "px";
canvas.style.height = height + "px";
canvas.width = width * window.devicePixelRatio;
canvas.height = height * window.devicePixelRatio;
} }
// Prevent some default browser shortcuts from preventing ImHex ones to work // Prevent some default browser shortcuts from preventing ImHex ones to work

View File

@@ -513,10 +513,6 @@ namespace hex::init {
if (meanScale <= 0.0F) if (meanScale <= 0.0F)
meanScale = 1.0F; meanScale = 1.0F;
#if defined(OS_WEB)
meanScale = 1.0F;
#endif
#if !defined(OS_LINUX) #if !defined(OS_LINUX)
meanScale /= hex::ImHexApi::System::getBackingScaleFactor(); meanScale /= hex::ImHexApi::System::getBackingScaleFactor();
#endif #endif