Fix settings size when hidden

This commit is contained in:
Ethan O'Brien 2023-08-08 13:04:42 -05:00
parent dadfc40903
commit 81a6b94f4f
2 changed files with 12 additions and 2 deletions

View file

@ -987,6 +987,7 @@ class EmulatorJS {
if (this.touch) {
this.virtualGamepad.style.display = "";
}
this.handleResize();
} catch(e) {
console.warn("failed to start game", e);
this.textElem.innerText = this.localization("Failed to start game");
@ -1432,7 +1433,6 @@ class EmulatorJS {
if (!this.paused) this.togglePlaying(dontUpdate);
}
let stateUrl;
const saveState = addButton("Save State", '<svg viewBox="0 0 448 512"><path fill="currentColor" d="M433.941 129.941l-83.882-83.882A48 48 0 0 0 316.118 32H48C21.49 32 0 53.49 0 80v352c0 26.51 21.49 48 48 48h352c26.51 0 48-21.49 48-48V163.882a48 48 0 0 0-14.059-33.941zM224 416c-35.346 0-64-28.654-64-64 0-35.346 28.654-64 64-64s64 28.654 64 64c0 35.346-28.654 64-64 64zm96-304.52V212c0 6.627-5.373 12-12 12H76c-6.627 0-12-5.373-12-12V108c0-6.627 5.373-12 12-12h228.52c3.183 0 6.235 1.264 8.485 3.515l3.48 3.48A11.996 11.996 0 0 1 320 111.48z"/></svg>', async () => {
const state = await this.gameManager.getState();
@ -3183,6 +3183,12 @@ class EmulatorJS {
home.style.overflow = "auto";
const menus = [];
this.handleSettingsResize = () => {
let needChange = false;
if (this.settingsMenu.style.display !== "") {
this.settingsMenu.style.opacity = "0";
this.settingsMenu.style.display = "";
needChange = true;
}
const x = this.settingsMenu.parentElement.getBoundingClientRect().x;
let height = this.elements.parent.getBoundingClientRect().height;
let width = this.elements.parent.getBoundingClientRect().width;
@ -3206,6 +3212,10 @@ class EmulatorJS {
this.settingsMenu.classList.remove("ejs_settings_leftside");
this.settingsMenu.classList.remove("ejs_settings_center");
}
if (needChange) {
this.settingsMenu.style.display = "none";
this.settingsMenu.style.opacity = "";
}
}
home.classList.add("ejs_setting_menu");

File diff suppressed because one or more lines are too long