mirror of
https://github.com/EmulatorJS/EmulatorJS.git
synced 2026-02-06 11:17:36 +00:00
Fix case where 2 gamepads are disconnected at once
This commit is contained in:
parent
908bccd63c
commit
a1efedfbea
@ -1121,7 +1121,8 @@ class EmulatorJS {
|
||||
this.updateGamepadLabels();
|
||||
})
|
||||
this.gamepad.on('disconnected', (e) => {
|
||||
const gamepadSelection = this.gamepad.gamepads[e.gamepadIndex].id + "_" + this.gamepad.gamepads[e.gamepadIndex].index;
|
||||
const gamepadIndex = this.gamepad.gamepads.indexOf(this.gamepad.gamepads.find(f => f.index == e.gamepadIndex));
|
||||
const gamepadSelection = this.gamepad.gamepads[gamepadIndex].id + "_" + this.gamepad.gamepads[gamepadIndex].index;
|
||||
for (let i = 0; i < this.gamepadSelection.length; i++) {
|
||||
if (this.gamepadSelection[i] === gamepadSelection) {
|
||||
this.gamepadSelection[i] = "";
|
||||
|
||||
Loading…
Reference in New Issue
Block a user