From 14156b86235765d5c5d018fea638910e02e70f68 Mon Sep 17 00:00:00 2001
From: Sam Wilkins <samwilkins333@gmail.com>
Date: Sat, 29 Jun 2019 19:25:50 -0400
Subject: keyhandler static changes

---
 src/client/views/MainView.tsx | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

(limited to 'src/client/views/MainView.tsx')

diff --git a/src/client/views/MainView.tsx b/src/client/views/MainView.tsx
index fe3ff2392..fb88c284f 100644
--- a/src/client/views/MainView.tsx
+++ b/src/client/views/MainView.tsx
@@ -64,24 +64,23 @@ export class MainView extends React.Component {
     }
 
     componentWillMount() {
-        KeyManager.Handler = new KeyManager(this);
-        document.removeEventListener("keydown", KeyManager.Handler.handle);
-        document.addEventListener("keydown", KeyManager.Handler.handle);
+        window.removeEventListener("keydown", KeyManager.Handler.handle);
+        window.addEventListener("keydown", KeyManager.Handler.handle);
 
-        document.removeEventListener("pointerdown", this.pointerDown);
-        document.addEventListener("pointerdown", this.pointerDown);
+        window.removeEventListener("pointerdown", this.pointerDown);
+        window.addEventListener("pointerdown", this.pointerDown);
 
-        document.removeEventListener("pointerup", this.pointerUp);
-        document.addEventListener("pointerup", this.pointerUp);
+        window.removeEventListener("pointerup", this.pointerUp);
+        window.addEventListener("pointerup", this.pointerUp);
     }
 
     pointerDown = (e: PointerEvent) => this.isPointerDown = true;
     pointerUp = (e: PointerEvent) => this.isPointerDown = false;
 
     componentWillUnMount() {
-        document.removeEventListener("keydown", KeyManager.Handler.handle);
-        document.removeEventListener("pointerdown", this.pointerDown);
-        document.removeEventListener("pointerup", this.pointerUp);
+        window.removeEventListener("keydown", KeyManager.Handler.handle);
+        window.removeEventListener("pointerdown", this.pointerDown);
+        window.removeEventListener("pointerup", this.pointerUp);
     }
 
     constructor(props: Readonly<{}>) {
-- 
cgit v1.2.3-70-g09d2

