Do not crash on resize when application has not started yet.

This commit is contained in:
Bartosz Taudul 2022-10-18 21:00:20 +02:00
parent dc6c3962d3
commit 9bc8580f99
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3

View File

@ -92,7 +92,9 @@
function resizeHandler() {
let w = Math.floor(Math.floor(window.innerWidth * window.devicePixelRatio) / window.devicePixelRatio);
let h = Math.floor(Math.floor(window.innerHeight * window.devicePixelRatio) / window.devicePixelRatio);
Module.ccall('nativeResize', 'number', ['number', 'number'], [w * window.devicePixelRatio, h * window.devicePixelRatio]);
if(preloadElement.hidden === true) {
Module.ccall('nativeResize', 'number', ['number', 'number'], [w * window.devicePixelRatio, h * window.devicePixelRatio]);
}
Module.canvas.style.width = w + 'px';
Module.canvas.style.height = h + 'px';
}