Fix modifierkey setting for mac (#2327)

## Description:

Currently not an issue, but this is a code smell in case we ever decide
to have it editable, current implementation will make the default
overwrite the custom setting

Pointed out by  #1804


## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [x] I have added relevant tests to the test directory
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced

## Please put your Discord username so you can be contacted if a bug or
regression is found:

Mr. Box
This commit is contained in:
Vivacious Box
2025-10-30 03:58:08 +01:00
committed by GitHub
parent fbb818bab1
commit 0def339ad9
+4 -7
View File
@@ -167,6 +167,9 @@ export class InputHandler {
console.warn("Invalid keybinds JSON:", e);
}
// Mac users might have different keybinds
const isMac = /Mac/.test(navigator.userAgent);
this.keybinds = {
toggleView: "Space",
centerCamera: "KeyC",
@@ -180,7 +183,7 @@ export class InputHandler {
attackRatioUp: "KeyY",
boatAttack: "KeyB",
groundAttack: "KeyG",
modifierKey: "ControlLeft",
modifierKey: isMac ? "MetaLeft" : "ControlLeft",
altKey: "AltLeft",
buildCity: "Digit1",
buildFactory: "Digit2",
@@ -195,12 +198,6 @@ export class InputHandler {
...saved,
};
// Mac users might have different keybinds
const isMac = /Mac/.test(navigator.userAgent);
if (isMac) {
this.keybinds.modifierKey = "MetaLeft"; // Use Command key on Mac
}
this.canvas.addEventListener("pointerdown", (e) => this.onPointerDown(e));
window.addEventListener("pointerup", (e) => this.onPointerUp(e));
this.canvas.addEventListener(