fix stuck screen on unknwo button

pull/685/head
Greenlamp 2024-05-14 19:41:11 +02:00
parent c7d26ac9bc
commit fcdbf2b5c0
2 changed files with 3 additions and 3 deletions

View File

@ -18,12 +18,12 @@ export default class GamepadBindingUiHandler extends AbstractBindingUiHandler {
const blacklist = [12, 13, 14, 15]; // d-pad buttons are blacklisted.
// Check conditions before processing the button press.
if (!this.listening || pad.id !== this.scene.inputController?.chosenGamepad || blacklist.includes(button.index) || this.buttonPressed !== null) return;
this.buttonPressed = button.index;
const activeConfig = this.scene.inputController.getActiveConfig();
const type = activeConfig.padType
const key = getKeyFromMapping(activeConfig, this.buttonPressed);
const key = getKeyFromMapping(activeConfig, button.index);
const buttonIcon = activeConfig.ogIcons[key];
if (!buttonIcon) return;
this.buttonPressed = button.index;
const assignedButtonIcon = getKeyAndActionFromCurrentKeysWithSettingName(activeConfig, this.target)?.icon;
this.onInputDown(buttonIcon, assignedButtonIcon, type);
}

View File

@ -18,11 +18,11 @@ export default class KeyboardBindingUiHandler extends AbstractBindingUiHandler {
const key = event.keyCode;
// // Check conditions before processing the button press.
if (!this.listening || this.buttonPressed !== null) return;
this.buttonPressed = key;
const activeConfig = this.scene.inputController.getActiveKeyboardConfig();
const _key = getKeyFromMapping(activeConfig, key);
const buttonIcon = activeConfig.ogIcons[_key];
if (!buttonIcon) return;
this.buttonPressed = key;
const assignedButtonIcon = getKeyAndActionFromCurrentKeysWithSettingName(activeConfig, this.target)?.icon;
this.onInputDown(buttonIcon, assignedButtonIcon, 'keyboard');
}