Remapping: Popover tabs initialization accordance with the key action

This commit is contained in:
József Farkas
2016-08-06 17:26:36 +02:00
parent a09bc3cccc
commit b0b76fe1c2
19 changed files with 320 additions and 200 deletions

View File

@@ -124,6 +124,8 @@ export class SvgKeyboardKeyComponent implements OnInit, OnChanges {
break;
}
this.labelSource = newLabelSource;
} else {
this.labelSource = undefined;
}
} else if (this.keyAction instanceof SwitchLayerAction) {
let keyAction: SwitchLayerAction = this.keyAction as SwitchLayerAction;

View File

@@ -1,4 +1,4 @@
<svg-keyboard [moduleConfig]="moduleConfig"
(keyClick)="onKeyClick($event.moduleId, $event.keyId)">
</svg-keyboard>
<popover *ngIf="popoverEnabled" (cancel)="hidePopover()" (remap)="onRemap($event)"></popover>
<popover *ngIf="popoverEnabled" [defaultKeyAction]="popoverInitKeyAction" (cancel)="hidePopover()" (remap)="onRemap($event)"></popover>

Before

Width:  |  Height:  |  Size: 221 B

After

Width:  |  Height:  |  Size: 263 B

View File

@@ -16,6 +16,7 @@ export class SvgKeyboardPopoverComponent implements OnInit {
private popoverEnabled: boolean;
private keyEditConfig: { moduleId: number, keyId: number };
private popoverInitKeyAction: KeyAction;
constructor() {
this.keyEditConfig = {
@@ -32,7 +33,9 @@ export class SvgKeyboardPopoverComponent implements OnInit {
moduleId,
keyId
};
this.showPopover();
let keyActionToEdit: KeyAction = this.moduleConfig[moduleId].keyActions.elements[keyId];
this.showPopover(keyActionToEdit);
}
}
@@ -41,12 +44,14 @@ export class SvgKeyboardPopoverComponent implements OnInit {
this.hidePopover();
}
showPopover(): void {
showPopover(keyAction?: KeyAction): void {
this.popoverInitKeyAction = keyAction;
this.popoverEnabled = true;
}
hidePopover(): void {
this.popoverEnabled = false;
this.popoverInitKeyAction = undefined;
}
changeKeyAction(keyAction: KeyAction): void {