From c16365a0e5a69ecfc37126b9463e5213fbfaae3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=B3bert=20Kiss?= Date: Tue, 11 Sep 2018 22:29:30 +0200 Subject: [PATCH] fix: Alt+Tab triggers "Remap on all layers" (#773) --- .../svg-keyboard-key.component.ts | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/packages/uhk-web/src/app/components/svg/keys/svg-keyboard-key/svg-keyboard-key.component.ts b/packages/uhk-web/src/app/components/svg/keys/svg-keyboard-key/svg-keyboard-key.component.ts index 10fd4f97..8f051aef 100644 --- a/packages/uhk-web/src/app/components/svg/keys/svg-keyboard-key/svg-keyboard-key.component.ts +++ b/packages/uhk-web/src/app/components/svg/keys/svg-keyboard-key/svg-keyboard-key.component.ts @@ -120,13 +120,13 @@ export class SvgKeyboardKeyComponent implements OnInit, OnChanges, OnDestroy { this.scanCodePressed = false; } - @HostListener('click') - onClick() { + @HostListener('click', ['$event']) + onClick(e: MouseEvent) { this.reset(); this.keyClick.emit({ keyTarget: this.element.nativeElement, - shiftPressed: this.pressedShiftLocation > -1, - altPressed: this.pressedAltLocation > -1 + shiftPressed: e.shiftKey, + altPressed: e.altKey }); this.pressedShiftLocation = -1; this.pressedAltLocation = -1; @@ -143,14 +143,8 @@ export class SvgKeyboardKeyComponent implements OnInit, OnChanges, OnDestroy { } else { this.recording = true; this.recordAnimation = 'active'; - - if (this.pressedShiftLocation > -1) { - this.shiftPressed = true; - } - - if (this.pressedAltLocation > -1) { - this.altPressed = true; - } + this.shiftPressed = e.shiftKey; + this.altPressed = e.altKey; } } }