From f679b265e9104b9038cc664e00a6840b47df191c Mon Sep 17 00:00:00 2001 From: Ethan O'Brien Date: Sat, 5 Jul 2025 00:19:05 -0500 Subject: [PATCH] Add sizes to parent element --- data/emulator.css | 5 +++++ data/src/emulator.js | 9 +-------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/data/emulator.css b/data/emulator.css index 4f37df1..27f916f 100644 --- a/data/emulator.css +++ b/data/emulator.css @@ -221,6 +221,11 @@ height: 100%; } +.ejs_canvas_parent { + width: 100%; + height: 100%; +} + .ejs_context_menu { position: absolute; display: none; diff --git a/data/src/emulator.js b/data/src/emulator.js index 84d43c9..c23fc0c 100644 --- a/data/src/emulator.js +++ b/data/src/emulator.js @@ -1006,6 +1006,7 @@ class EmulatorJS { this.textElem.remove(); this.textElem = null; this.game.classList.remove("ejs_game"); + this.game.classList.add("ejs_canvas_parent"); this.game.appendChild(this.canvas); this.handleResize(); this.started = true; @@ -4109,14 +4110,6 @@ class EmulatorJS { //This wouldnt work using :not()... strange. this.game.parentElement.classList.toggle("ejs_big_screen", positionInfo.width > 575); - if (!this.Module) return; - const dpr = 1; //window.devicePixelRatio || 1; - const width = positionInfo.width * dpr; - const height = (positionInfo.height * dpr); - this.Module.canvas.style.width = width; - this.Module.canvas.style.height = height; - //this.Module.setCanvasSize(width, height); - if (!this.handleSettingsResize) return; this.handleSettingsResize(); }