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
+5 -1
View File
@@ -35,6 +35,7 @@ enum TabName {
}) })
export class PopoverComponent implements OnInit { export class PopoverComponent implements OnInit {
@Input() defaultKeyAction: KeyAction; @Input() defaultKeyAction: KeyAction;
@Input() currentKeymap: Keymap;
@Output() cancel = new EventEmitter<any>(); @Output() cancel = new EventEmitter<any>();
@Output() remap = new EventEmitter<KeyAction>(); @Output() remap = new EventEmitter<KeyAction>();
@@ -49,7 +50,10 @@ export class PopoverComponent implements OnInit {
private keymaps$: Observable<Keymap[]>; private keymaps$: Observable<Keymap[]>;
constructor(private store: Store<AppState>) { 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() { ngOnInit() {
@@ -24,12 +24,13 @@ export class KeymapTabComponent implements OnInit, Tab {
} }
ngOnInit() { ngOnInit() {
this.keymapOptions = this.keymaps.map((keymap: Keymap): Select2OptionData => { this.keymapOptions = this.keymaps
return { .map((keymap: Keymap): Select2OptionData => {
id: keymap.abbreviation, return {
text: keymap.name id: keymap.abbreviation,
}; text: keymap.name
}); };
});
this.keymapOptions = [ this.keymapOptions = [
{ {
@@ -9,7 +9,7 @@
> >
</svg-keyboard> </svg-keyboard>
</div> </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" <div class="tooltip top fade" role="tooltip"
[class.in]="tooltipData.shown" [class.in]="tooltipData.shown"
[style.top.px]="tooltipData.posTop" [style.top.px]="tooltipData.posTop"