1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2026-03-02 03:39:21 +00:00

Merge pull request #48 from Dimava/feature/mousebind

Mouse keybinds
This commit is contained in:
tobspr
2020-06-01 12:10:51 +02:00
committed by GitHub
5 changed files with 57 additions and 25 deletions

View File

@@ -121,9 +121,23 @@ export class KeybindingsState extends TextualGameState {
this.updateKeybindings();
});
dialog.inputReciever.backButton.add(() => {});
const clickListener = event => {
if (event.target.tagName == "BUTTON") {
return;
}
event.preventDefault();
const keyCode = event.button + 1;
this.app.settings.updateKeybindingOverride(id, keyCode);
this.dialogs.closeDialog(dialog);
this.updateKeybindings();
};
dialog.inputReciever.backButton.add(() => {});
this.dialogs.internalShowDialog(dialog);
dialog.element.addEventListener("mousedown", clickListener);
this.app.sound.playUiSound(SOUNDS.dialogOk);
}