Hide popover when you delete or switch keymap; Disable layer switch when popover is opened

This commit is contained in:
NejcZdovc
2016-11-17 07:12:38 +01:00
committed by József Farkas
parent 68d6dbe723
commit ff47222d21
6 changed files with 29 additions and 7 deletions

View File

@@ -1,5 +1,5 @@
<template ngIf="layers">
<layers (select)="selectLayer($event.oldIndex, $event.index)" [current]="currentLayer"></layers>
<layers [class.disabled]="popoverShown" (select)="selectLayer($event.oldIndex, $event.index)" [current]="currentLayer"></layers>
<div class="keyboard-slider" (mouseout)="hideTooltip($event)">
<svg-keyboard *ngFor="let layer of layers"
[@layerState]="layer.animation"

View File

@@ -91,6 +91,7 @@ export class SvgKeyboardWrapComponent implements OnChanges {
@Input() keymap: Keymap;
@Input() popoverEnabled: boolean = true;
@Input() tooltipEnabled: boolean = false;
@Input() deleted: boolean = false;
private popoverShown: boolean;
private keyEditConfig: { keyActions: KeyAction[], keyId: number };
@@ -119,11 +120,14 @@ export class SvgKeyboardWrapComponent implements OnChanges {
if (changes['keymap'].previousValue.abbreviation !== changes['keymap'].currentValue.abbreviation) {
this.layers = this.keymap.layers;
this.currentLayer = 0;
this.popoverShown = false;
if (this.layers.length > 0) {
this.layers.forEach(element => element.animation = 'none');
this.layers[0].animation = 'leftIn';
}
} else if (changes['keymap']) {
this.popoverShown = false;
}
}