From 764cd8344df2dc9b2c271d868ae193b98b829af7 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Tue, 24 Dec 2019 20:13:47 +0100 Subject: Fix lint issues --- src/renderer/runtime/view/input/gameinput.ts | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) (limited to 'src/renderer/runtime/view/input/gameinput.ts') diff --git a/src/renderer/runtime/view/input/gameinput.ts b/src/renderer/runtime/view/input/gameinput.ts index 67fbe0c..b116839 100644 --- a/src/renderer/runtime/view/input/gameinput.ts +++ b/src/renderer/runtime/view/input/gameinput.ts @@ -35,13 +35,8 @@ export class GameInputHandler extends Listenable<[GameInput]> { super(); this.input = new InputHandler( - new Set([ - 'ArrowLeft', - 'ArrowUp', - 'ArrowRight', - 'ArrowDown', - ...Object.keys(buttonMapping), - ])); + new Set(['ArrowLeft', 'ArrowUp', 'ArrowRight', 'ArrowDown', ...Object.keys(buttonMapping)]), + ); this.input.addListener((key: string, pressed: boolean) => { const button = buttonMapping[key]; @@ -57,17 +52,12 @@ export class GameInputHandler extends Listenable<[GameInput]> { const dir = vec2.create(); - if (this.input.has('ArrowLeft')) - vec2.add(dir, dir, [-1, 0]); - if (this.input.has('ArrowUp')) - vec2.add(dir, dir, [0, -1]); - if (this.input.has('ArrowRight')) - vec2.add(dir, dir, [1, 0]); - if (this.input.has('ArrowDown')) - vec2.add(dir, dir, [0, 1]); - - if (vec2.sqrLen(dir) > 0) - vec2.normalize(dir, dir); + if (this.input.has('ArrowLeft')) vec2.add(dir, dir, [-1, 0]); + if (this.input.has('ArrowUp')) vec2.add(dir, dir, [0, -1]); + if (this.input.has('ArrowRight')) vec2.add(dir, dir, [1, 0]); + if (this.input.has('ArrowDown')) vec2.add(dir, dir, [0, 1]); + + if (vec2.sqrLen(dir) > 0) vec2.normalize(dir, dir); this.runListeners({ type: 'direction', -- cgit v1.2.3