From 642d22526d102198ed624a2b1e2eaed3b8f731b6 Mon Sep 17 00:00:00 2001 From: Sam Wilkins Date: Sat, 29 Jun 2019 02:32:54 -0400 Subject: added acm scraping to master and made keyhandlers responsive to mac keystrokes --- src/client/views/GlobalKeyHandler.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/client') 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) => { -- cgit v1.2.3-70-g09d2