mirror of
https://github.com/EmulatorJS/EmulatorJS.git
synced 2024-09-20 02:46:23 +00:00
Mobile optimizations
This commit is contained in:
parent
1a6b8ef567
commit
b7a18b0b12
3 changed files with 30 additions and 16 deletions
7
a.html
7
a.html
|
@ -13,11 +13,10 @@
|
||||||
EJS_gameUrl = 'roms/mega_mountain.nes';
|
EJS_gameUrl = 'roms/mega_mountain.nes';
|
||||||
EJS_DEBUG_XX = true;
|
EJS_DEBUG_XX = true;
|
||||||
//EJS_AdUrl = "https://www.google.com/search?igu=1";
|
//EJS_AdUrl = "https://www.google.com/search?igu=1";
|
||||||
/*
|
|
||||||
EJS_Buttons = {
|
EJS_Buttons = {
|
||||||
mute: false,
|
restart: false
|
||||||
volume: true,
|
}
|
||||||
}*/
|
|
||||||
EJS_volume = 1;
|
EJS_volume = 1;
|
||||||
EJS_startOnLoaded = true;
|
EJS_startOnLoaded = true;
|
||||||
//EJS_loadStateURL = "mega_mountain.state";
|
//EJS_loadStateURL = "mega_mountain.state";
|
||||||
|
|
|
@ -208,6 +208,13 @@
|
||||||
transform: rotate(90deg);
|
transform: rotate(90deg);
|
||||||
}
|
}
|
||||||
@media (max-width: 575px) {
|
@media (max-width: 575px) {
|
||||||
|
.ejs_settings_leftside {
|
||||||
|
right: 50%
|
||||||
|
}
|
||||||
|
.ejs_settings_leftside::after {
|
||||||
|
left: 0px;
|
||||||
|
right: 15px;
|
||||||
|
}
|
||||||
.ejs_settings_parent::after {
|
.ejs_settings_parent::after {
|
||||||
left: 15px;
|
left: 15px;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1507,24 +1507,25 @@ class EmulatorJS {
|
||||||
|
|
||||||
|
|
||||||
if (this.config.buttonOpts) {
|
if (this.config.buttonOpts) {
|
||||||
if (!this.config.buttonOpts.playPause) {
|
console.log(this.config.buttonOpts);
|
||||||
|
if (this.config.buttonOpts.playPause === false) {
|
||||||
pauseButton.style.display = "none";
|
pauseButton.style.display = "none";
|
||||||
playButton.style.display = "none";
|
playButton.style.display = "none";
|
||||||
}
|
}
|
||||||
if (!this.config.buttonOpts.restart) restartButton.style.display = "none"
|
if (this.config.buttonOpts.restart === false) restartButton.style.display = "none"
|
||||||
if (!this.config.buttonOpts.settings) settingButton[0].style.display = "none"
|
if (this.config.buttonOpts.settings === false) settingButton[0].style.display = "none"
|
||||||
if (!this.config.buttonOpts.fullscreen) {
|
if (this.config.buttonOpts.fullscreen === false) {
|
||||||
enter.style.display = "none";
|
enter.style.display = "none";
|
||||||
exit.style.display = "none";
|
exit.style.display = "none";
|
||||||
}
|
}
|
||||||
if (!this.config.buttonOpts.saveState) saveState.style.display = "none"
|
if (this.config.buttonOpts.saveState === false) saveState.style.display = "none"
|
||||||
if (!this.config.buttonOpts.loadState) loadState.style.display = "none"
|
if (this.config.buttonOpts.loadState === false) loadState.style.display = "none"
|
||||||
if (!this.config.buttonOpts.saveSavFiles) saveSavFiles.style.display = "none"
|
if (this.config.buttonOpts.saveSavFiles === false) saveSavFiles.style.display = "none"
|
||||||
if (!this.config.buttonOpts.loadSavFiles) loadSavFiles.style.display = "none"
|
if (this.config.buttonOpts.loadSavFiles === false) loadSavFiles.style.display = "none"
|
||||||
if (!this.config.buttonOpts.gamepad) controlMenu.style.display = "none"
|
if (this.config.buttonOpts.gamepad === false) controlMenu.style.display = "none"
|
||||||
if (!this.config.buttonOpts.cheat) cheatMenu.style.display = "none"
|
if (this.config.buttonOpts.cheat === false) cheatMenu.style.display = "none"
|
||||||
if (!this.config.buttonOpts.cacheManager) cache.style.display = "none"
|
if (this.config.buttonOpts.cacheManager === false) cache.style.display = "none"
|
||||||
if (!this.config.buttonOpts.netplay) netplay.style.display = "none"
|
if (this.config.buttonOpts.netplay === false) netplay.style.display = "none"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
openCacheMenu() {
|
openCacheMenu() {
|
||||||
|
@ -2624,13 +2625,20 @@ class EmulatorJS {
|
||||||
home.style.overflow = "auto";
|
home.style.overflow = "auto";
|
||||||
const menus = [];
|
const menus = [];
|
||||||
this.handleSettingsResize = () => {
|
this.handleSettingsResize = () => {
|
||||||
|
const x = this.settingsMenu.parentElement.getBoundingClientRect().x;
|
||||||
let height = this.elements.parent.getBoundingClientRect().height;
|
let height = this.elements.parent.getBoundingClientRect().height;
|
||||||
|
let width = this.elements.parent.getBoundingClientRect().width;
|
||||||
if (height > 375) height = 375;
|
if (height > 375) height = 375;
|
||||||
home.style['max-height'] = (height - 95) + "px";
|
home.style['max-height'] = (height - 95) + "px";
|
||||||
nested.style['max-height'] = (height - 95) + "px";
|
nested.style['max-height'] = (height - 95) + "px";
|
||||||
for (let i=0; i<menus.length; i++) {
|
for (let i=0; i<menus.length; i++) {
|
||||||
menus[i].style['max-height'] = (height - 95) + "px";
|
menus[i].style['max-height'] = (height - 95) + "px";
|
||||||
}
|
}
|
||||||
|
if (width < 575) {
|
||||||
|
this.settingsMenu.classList.toggle("ejs_settings_leftside", !((window.innerWidth/2) > x));
|
||||||
|
} else {
|
||||||
|
this.settingsMenu.classList.remove("ejs_settings_leftside");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
home.classList.add("ejs_setting_menu");
|
home.classList.add("ejs_setting_menu");
|
||||||
|
|
Loading…
Reference in a new issue