mirror of
https://github.com/EmulatorJS/EmulatorJS.git
synced 2024-09-20 02:46:23 +00:00
Add EJS_noAutoFocus
This commit is contained in:
parent
0d892cc39e
commit
065e37342a
2 changed files with 4 additions and 3 deletions
|
@ -1128,7 +1128,7 @@ class EmulatorJS {
|
||||||
this.updateCheatUI();
|
this.updateCheatUI();
|
||||||
this.updateGamepadLabels();
|
this.updateGamepadLabels();
|
||||||
if (!this.muted) this.setVolume(this.volume);
|
if (!this.muted) this.setVolume(this.volume);
|
||||||
this.elements.parent.focus();
|
if (this.config.noAutoFocus !== true) this.elements.parent.focus();
|
||||||
this.textElem.remove();
|
this.textElem.remove();
|
||||||
this.textElem = null;
|
this.textElem = null;
|
||||||
this.game.classList.remove("ejs_game");
|
this.game.classList.remove("ejs_game");
|
||||||
|
@ -1196,7 +1196,7 @@ class EmulatorJS {
|
||||||
this.setVirtualGamepad();
|
this.setVirtualGamepad();
|
||||||
this.addEventListener(this.elements.parent, "keydown keyup", this.keyChange.bind(this));
|
this.addEventListener(this.elements.parent, "keydown keyup", this.keyChange.bind(this));
|
||||||
this.addEventListener(this.elements.parent, "mousedown touchstart", (e) => {
|
this.addEventListener(this.elements.parent, "mousedown touchstart", (e) => {
|
||||||
if (document.activeElement !== this.elements.parent) this.elements.parent.focus();
|
if (document.activeElement !== this.elements.parent && this.config.noAutoFocus !== true) this.elements.parent.focus();
|
||||||
})
|
})
|
||||||
this.addEventListener(window, "resize", this.handleResize.bind(this));
|
this.addEventListener(window, "resize", this.handleResize.bind(this));
|
||||||
//this.addEventListener(window, "blur", e => console.log(e), true); //TODO - add "click to make keyboard keys work" message?
|
//this.addEventListener(window, "blur", e => console.log(e), true); //TODO - add "click to make keyboard keys work" message?
|
||||||
|
@ -1211,7 +1211,7 @@ class EmulatorJS {
|
||||||
this.addEventListener(window, "webkitfullscreenchange mozfullscreenchange fullscreenchange MSFullscreenChange", () => {
|
this.addEventListener(window, "webkitfullscreenchange mozfullscreenchange fullscreenchange MSFullscreenChange", () => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.handleResize.bind(this);
|
this.handleResize.bind(this);
|
||||||
this.elements.parent.focus();
|
if (this.config.noAutoFocus !== true) this.elements.parent.focus();
|
||||||
}, 0);
|
}, 0);
|
||||||
});
|
});
|
||||||
this.addEventListener(this.elements.parent, "dragenter", (e) => {
|
this.addEventListener(this.elements.parent, "dragenter", (e) => {
|
||||||
|
|
|
@ -112,6 +112,7 @@
|
||||||
config.disableDatabases = window.EJS_disableDatabases;
|
config.disableDatabases = window.EJS_disableDatabases;
|
||||||
config.disableLocalStorage = window.EJS_disableLocalStorage;
|
config.disableLocalStorage = window.EJS_disableLocalStorage;
|
||||||
config.forceLegacyCores = window.EJS_forceLegacyCores;
|
config.forceLegacyCores = window.EJS_forceLegacyCores;
|
||||||
|
config.noAutoFocus = window.EJS_noAutoFocus;
|
||||||
|
|
||||||
if (typeof window.EJS_language === "string" && window.EJS_language !== "en-US") {
|
if (typeof window.EJS_language === "string" && window.EJS_language !== "en-US") {
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in a new issue