Add sizes to parent element

This commit is contained in:
Ethan O'Brien 2025-07-05 00:19:05 -05:00
parent c7d6a49fdb
commit f679b265e9
No known key found for this signature in database
GPG Key ID: 7A6E7CCD3BD93AB1
2 changed files with 6 additions and 8 deletions

View File

@ -221,6 +221,11 @@
height: 100%;
}
.ejs_canvas_parent {
width: 100%;
height: 100%;
}
.ejs_context_menu {
position: absolute;
display: none;

View File

@ -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();
}