aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/GlobalKeyHandler.ts
diff options
context:
space:
mode:
authorSam Wilkins <samwilkins333@gmail.com>2019-06-29 02:32:54 -0400
committerSam Wilkins <samwilkins333@gmail.com>2019-06-29 02:32:54 -0400
commit642d22526d102198ed624a2b1e2eaed3b8f731b6 (patch)
tree5ff8261328dd70e45989908d8ab0153854a48f78 /src/client/views/GlobalKeyHandler.ts
parenta446286326e04dc5c3958d157cc9120603d42b76 (diff)
added acm scraping to master and made keyhandlers responsive to mac keystrokes
Diffstat (limited to 'src/client/views/GlobalKeyHandler.ts')
-rw-r--r--src/client/views/GlobalKeyHandler.ts12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/client/views/GlobalKeyHandler.ts b/src/client/views/GlobalKeyHandler.ts
index bb10f27cf..95a367cea 100644
--- a/src/client/views/GlobalKeyHandler.ts
+++ b/src/client/views/GlobalKeyHandler.ts
@@ -4,8 +4,9 @@ import { CollectionDockingView } from "./collections/CollectionDockingView";
import { MainView } from "./MainView";
import { DragManager } from "../util/DragManager";
import { action } from "mobx";
+import { emptyFunction } from "../../Utils";
-const modifiers = ["Control", "Meta", "Shift", "Alt"];
+const modifiers = ["control", "meta", "shift", "alt"];
type KeyHandler = (keycode: string) => KeyControlInfo;
type KeyControlInfo = {
preventDefault: boolean,
@@ -19,10 +20,13 @@ export default class KeyManager {
constructor(mainView: MainView) {
this.mainView = mainView;
+
+ let isMac = navigator.platform.toLowerCase().indexOf("mac") >= 0;
+
this.router.set("0000", this.unmodified);
- this.router.set("0100", this.ctrl);
- this.router.set("0010", this.alt);
- this.router.set("1100", this.ctrl_shift);
+ this.router.set(isMac ? "0001" : "0100", this.ctrl);
+ this.router.set(isMac ? "0100" : "0010", this.alt);
+ this.router.set(isMac ? "1001" : "1100", this.ctrl_shift);
}
public handle = (e: KeyboardEvent) => {