From 1c6b6d0ad14330cc42fe44e02f6e1b917453862e Mon Sep 17 00:00:00 2001 From: Ethan O'Brien <77750390+ethanaobrien@users.noreply.github.com> Date: Sat, 8 Jul 2023 19:12:55 -0500 Subject: [PATCH] Resize proxy function --- data/emulator.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/data/emulator.js b/data/emulator.js index ed35942..64b940c 100644 --- a/data/emulator.js +++ b/data/emulator.js @@ -767,6 +767,13 @@ class EmulatorJS { } this.callEvent("start"); } + onResize() { + this.handleResize(); + setTimeout(this.handleResize.bind(this), 50); + setTimeout(this.handleResize.bind(this), 100); + setTimeout(this.handleResize.bind(this), 500); + setTimeout(this.handleResize.bind(this), 1000); + } bindListeners() { this.createContextMenu(); this.createBottomMenuBar(); @@ -777,7 +784,7 @@ class EmulatorJS { this.addEventListener(this.elements.parent, "mousedown touchstart", (e) => { if (document.activeElement !== this.elements.parent) this.elements.parent.focus(); }) - this.addEventListener(window, "resize", this.handleResize.bind(this)); + this.addEventListener(window, "resize", this.onResize.bind(this)); //this.addEventListener(window, "blur", e => console.log(e), true); //TODO - add "click to make keyboard keys work" message? this.gamepad = new GamepadHandler(); //https://github.com/ethanaobrien/Gamepad this.gamepad.on('connected', (e) => { @@ -1293,6 +1300,7 @@ class EmulatorJS { screen.orientation.lock(this.getCore(true) === "nds" ? "portrait" : "landscape").catch(e => {});; } catch(e) {} } + this.onResize(); }); const exit = addButton("Exit Fullscreen", '', () => { if (document.exitFullscreen) { @@ -1311,6 +1319,7 @@ class EmulatorJS { screen.orientation.unlock(); } catch(e) {} } + this.onResize(); }); exit.style.display = "none";