feat: Make Right click, Esc set the key action to none (#897)

* feat: Make Right click, Esc set the key action to none

* refactor: use ts-keycode-enum; revert: escape from mapping on pressing escape.
This commit is contained in:
dgyimesi
2019-01-24 14:25:22 +01:00
committed by László Monda
parent d674fd4490
commit c36156b497
6 changed files with 566 additions and 547 deletions
@@ -1,6 +1,8 @@
import { ChangeDetectionStrategy, Component, EventEmitter, HostListener, Input, Output } from '@angular/core';
import { Store } from '@ngrx/store';
import { Key } from 'ts-keycode-enum';
import { CaptureService } from '../../../../services/capture.service';
import { KeyModifierModel } from '../../../../models/key-modifier-model';
import { AppState } from '../../../../store';
@@ -45,7 +47,6 @@ export class CaptureKeystrokeButtonComponent {
@HostListener('keydown', ['$event'])
onKeyDown(e: KeyboardEvent) {
const code: number = e.keyCode;
const enter = 13;
if (this.record) {
e.preventDefault();
@@ -58,7 +59,7 @@ export class CaptureKeystrokeButtonComponent {
} else {
this.captureService.setModifier((e.location === 1), code);
}
} else if (code === enter) {
} else if (code === Key.Enter) {
this.record = true;
this.first = true;
this.store.dispatch(new StartKeypressCapturingAction());