Removed current keymap from switch (#165)

Closes #160
This commit is contained in:
Nejc Zdovc
2016-11-20 13:24:17 +01:00
committed by József Farkas
parent 1d47f9c758
commit ac499d21f7
3 changed files with 13 additions and 8 deletions

View File

@@ -35,6 +35,7 @@ enum TabName {
})
export class PopoverComponent implements OnInit {
@Input() defaultKeyAction: KeyAction;
@Input() currentKeymap: Keymap;
@Output() cancel = new EventEmitter<any>();
@Output() remap = new EventEmitter<KeyAction>();
@@ -49,7 +50,10 @@ export class PopoverComponent implements OnInit {
private keymaps$: Observable<Keymap[]>;
constructor(private store: Store<AppState>) {
this.keymaps$ = store.let(getKeymapEntities());
this.keymaps$ = store.let(getKeymapEntities())
.map((keymaps: Keymap[]) =>
keymaps.filter((keymap: Keymap) => this.currentKeymap.abbreviation !== keymap.abbreviation)
);
}
ngOnInit() {

View File

@@ -24,12 +24,13 @@ export class KeymapTabComponent implements OnInit, Tab {
}
ngOnInit() {
this.keymapOptions = this.keymaps.map((keymap: Keymap): Select2OptionData => {
return {
id: keymap.abbreviation,
text: keymap.name
};
});
this.keymapOptions = this.keymaps
.map((keymap: Keymap): Select2OptionData => {
return {
id: keymap.abbreviation,
text: keymap.name
};
});
this.keymapOptions = [
{

View File

@@ -9,7 +9,7 @@
>
</svg-keyboard>
</div>
<popover *ngIf="popoverShown" [defaultKeyAction]="popoverInitKeyAction" (cancel)="hidePopover()" (remap)="onRemap($event)"></popover>
<popover *ngIf="popoverShown" [defaultKeyAction]="popoverInitKeyAction" [currentKeymap]="keymap" (cancel)="hidePopover()" (remap)="onRemap($event)"></popover>
<div class="tooltip top fade" role="tooltip"
[class.in]="tooltipData.shown"
[style.top.px]="tooltipData.posTop"