1
0
mirror of synced 2024-11-24 07:40:17 +01:00

web: Fix canvas to the top left of the screen

This commit is contained in:
WerWolv 2024-07-04 21:37:51 +02:00
parent 9fd547112d
commit c26eccfe28
2 changed files with 14 additions and 0 deletions

View File

@ -180,3 +180,9 @@ a:hover {
height: 25%; height: 25%;
margin-top: 50px; margin-top: 50px;
} }
.canvas-fixed {
position: absolute;
top: 0;
left: 0;
}

View File

@ -25,6 +25,10 @@ EM_JS(void, resizeCanvas, (), {
js_resizeCanvas(); js_resizeCanvas();
}); });
EM_JS(void, fixCanvasInPlace, (), {
document.getElementById('canvas').classList.add('canvas-fixed');
});
EM_JS(void, setupThemeListener, (), { EM_JS(void, setupThemeListener, (), {
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', event => { window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', event => {
Module._handleThemeChange(); Module._handleThemeChange();
@ -88,6 +92,9 @@ namespace hex {
return; return;
alert("Failed to load permanent file system: "+err); alert("Failed to load permanent file system: "+err);
}); });
// Center splash screen
document.getElementById('canvas').classList.remove('canvas-fixed');
}); });
} }
@ -95,6 +102,7 @@ namespace hex {
resizeCanvas(); resizeCanvas();
setupThemeListener(); setupThemeListener();
setupInputModeListener(); setupInputModeListener();
fixCanvasInPlace();
bool themeFollowSystem = ImHexApi::System::usesSystemThemeDetection(); bool themeFollowSystem = ImHexApi::System::usesSystemThemeDetection();
EventOSThemeChanged::subscribe(this, [themeFollowSystem] { EventOSThemeChanged::subscribe(this, [themeFollowSystem] {