From b7a18b0b1272fe5e665eecce5e8fd09caedd9aaa Mon Sep 17 00:00:00 2001 From: Ethan O'Brien <77750390+ethanaobrien@users.noreply.github.com> Date: Mon, 17 Jul 2023 13:33:42 -0500 Subject: [PATCH] Mobile optimizations --- a.html | 7 +++---- data/css/main.css | 7 +++++++ data/emulator.js | 32 ++++++++++++++++++++------------ 3 files changed, 30 insertions(+), 16 deletions(-) diff --git a/a.html b/a.html index dd4a68d..f004ea5 100644 --- a/a.html +++ b/a.html @@ -13,11 +13,10 @@ EJS_gameUrl = 'roms/mega_mountain.nes'; EJS_DEBUG_XX = true; //EJS_AdUrl = "https://www.google.com/search?igu=1"; - /* + EJS_Buttons = { - mute: false, - volume: true, - }*/ + restart: false + } EJS_volume = 1; EJS_startOnLoaded = true; //EJS_loadStateURL = "mega_mountain.state"; diff --git a/data/css/main.css b/data/css/main.css index ce29fcc..1cbc433 100644 --- a/data/css/main.css +++ b/data/css/main.css @@ -208,6 +208,13 @@ transform: rotate(90deg); } @media (max-width: 575px) { + .ejs_settings_leftside { + right: 50% + } + .ejs_settings_leftside::after { + left: 0px; + right: 15px; + } .ejs_settings_parent::after { left: 15px; } diff --git a/data/emulator.js b/data/emulator.js index c585dce..1c7ed0d 100644 --- a/data/emulator.js +++ b/data/emulator.js @@ -1507,24 +1507,25 @@ class EmulatorJS { if (this.config.buttonOpts) { - if (!this.config.buttonOpts.playPause) { + console.log(this.config.buttonOpts); + if (this.config.buttonOpts.playPause === false) { pauseButton.style.display = "none"; playButton.style.display = "none"; } - if (!this.config.buttonOpts.restart) restartButton.style.display = "none" - if (!this.config.buttonOpts.settings) settingButton[0].style.display = "none" - if (!this.config.buttonOpts.fullscreen) { + if (this.config.buttonOpts.restart === false) restartButton.style.display = "none" + if (this.config.buttonOpts.settings === false) settingButton[0].style.display = "none" + if (this.config.buttonOpts.fullscreen === false) { enter.style.display = "none"; exit.style.display = "none"; } - if (!this.config.buttonOpts.saveState) saveState.style.display = "none" - if (!this.config.buttonOpts.loadState) loadState.style.display = "none" - if (!this.config.buttonOpts.saveSavFiles) saveSavFiles.style.display = "none" - if (!this.config.buttonOpts.loadSavFiles) loadSavFiles.style.display = "none" - if (!this.config.buttonOpts.gamepad) controlMenu.style.display = "none" - if (!this.config.buttonOpts.cheat) cheatMenu.style.display = "none" - if (!this.config.buttonOpts.cacheManager) cache.style.display = "none" - if (!this.config.buttonOpts.netplay) netplay.style.display = "none" + if (this.config.buttonOpts.saveState === false) saveState.style.display = "none" + if (this.config.buttonOpts.loadState === false) loadState.style.display = "none" + if (this.config.buttonOpts.saveSavFiles === false) saveSavFiles.style.display = "none" + if (this.config.buttonOpts.loadSavFiles === false) loadSavFiles.style.display = "none" + if (this.config.buttonOpts.gamepad === false) controlMenu.style.display = "none" + if (this.config.buttonOpts.cheat === false) cheatMenu.style.display = "none" + if (this.config.buttonOpts.cacheManager === false) cache.style.display = "none" + if (this.config.buttonOpts.netplay === false) netplay.style.display = "none" } } openCacheMenu() { @@ -2624,13 +2625,20 @@ class EmulatorJS { home.style.overflow = "auto"; const menus = []; this.handleSettingsResize = () => { + const x = this.settingsMenu.parentElement.getBoundingClientRect().x; let height = this.elements.parent.getBoundingClientRect().height; + let width = this.elements.parent.getBoundingClientRect().width; if (height > 375) height = 375; home.style['max-height'] = (height - 95) + "px"; nested.style['max-height'] = (height - 95) + "px"; for (let i=0; i x)); + } else { + this.settingsMenu.classList.remove("ejs_settings_leftside"); + } } home.classList.add("ejs_setting_menu");