From 806623af696f625618f9a073739cb1b6e4742e7c Mon Sep 17 00:00:00 2001
From: Ethan O'Brien <77750390+ethanaobrien@users.noreply.github.com>
Date: Wed, 24 Jan 2024 00:44:21 -0600
Subject: [PATCH] Fix settings menu on mobile positioning
---
data/emulator.js | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/data/emulator.js b/data/emulator.js
index 1ac4c8f..03fb8df 100644
--- a/data/emulator.js
+++ b/data/emulator.js
@@ -1620,8 +1620,6 @@ class EmulatorJS {
return both ? [button, svg, text] : button;
}
- //todo. Center text on not restart button
-
const restartButton = addButton("Restart", '', () => {
if (this.isNetplay && this.netplay.owner) {
this.gameManager.saveSaveFiles();
@@ -3846,17 +3844,19 @@ class EmulatorJS {
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;
+ let w2 = this.settingParent.parentElement.getBoundingClientRect().width;
+ let settingsX = this.settingParent.getBoundingClientRect().x;
+ if (w2 > window.innerWidth) settingsX += (w2 - window.innerWidth);
+ const onTheRight = settingsX > (w2-15)/2;
if (height > 375) height = 375;
home.style['max-height'] = (height - 95) + "px";
nested.style['max-height'] = (height - 95) + "px";
for (let i=0; i= width/2) && (width < 575));
+ this.settingsMenu.classList.toggle("ejs_settings_center_left", !onTheRight);
+ this.settingsMenu.classList.toggle("ejs_settings_center_right", onTheRight);
if (needChange) {
this.settingsMenu.style.display = "none";
this.settingsMenu.style.opacity = "";