diff --git a/src/client/InputHandler.ts b/src/client/InputHandler.ts index 686ea2e48..25eab9237 100644 --- a/src/client/InputHandler.ts +++ b/src/client/InputHandler.ts @@ -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(