Touch handling cleanup

This commit is contained in:
Ethan O'Brien 2023-07-04 19:32:00 -05:00
parent e504a356df
commit 71c33ff3ee

View file

@ -312,6 +312,9 @@ class EmulatorJS {
}
}
startButtonClicked(e) {
if (e.pointerType === "touch") {
this.touch = true;
}
if (e.preventDefault) {
e.preventDefault();
e.target.remove();
@ -2411,7 +2414,7 @@ class EmulatorJS {
}, 'download');
}
if (this.touch) {
if (this.touch || navigator.maxTouchPoints > 0) {
addToMenu(this.localization('Virtual Gamepad'), 'virtual-gamepad', {
'enabled': this.localization("Enabled"),
'disabled': this.localization("Disabled")
@ -2422,6 +2425,7 @@ class EmulatorJS {
}, 'disabled');
}
if (this.gameManager.getCoreOptions()) {
this.gameManager.getCoreOptions().split('\n').forEach((line, index) => {
let option = line.split('; ');
let name = option[0];
@ -2437,6 +2441,7 @@ class EmulatorJS {
name.split("|")[0], availableOptions,
(name.split("|").length > 1) ? name.split("|")[1] : options[0].replace('(Default) ', ''));
})
}
this.settingsMenu.appendChild(nested);