Fixed default keymap selection in popover; Fixed keymap default image

This commit is contained in:
NejcZdovc
2016-11-17 06:01:22 +01:00
committed by József Farkas
parent 090d6565ce
commit 68d6dbe723
3 changed files with 22 additions and 7 deletions

View File

@@ -2,13 +2,13 @@
<b>Switch to keymap:</b>
<select2
[data]="keymapOptions"
[value]="selectedKeymap?.abbreviation"
[value]="selectedKeymap?.abbreviation || -1"
(valueChanged)="onChange($event)"
[width]="'100%'"
></select2>
</div>
<div>
<div *ngIf="!selectedKeymap?.abbreviation">
<div class="empty" *ngIf="!selectedKeymap?.abbreviation">
<img src="./images/base-layer--blank.svg">
</div>
<svg-keyboard *ngIf="selectedKeymap?.abbreviation"

View File

@@ -26,3 +26,14 @@
}
}
}
.empty {
display: flex;
img {
display: flex;
width: 100%;
height: 100%;
position: relative;
}
}

View File

@@ -24,11 +24,6 @@ export class KeymapTabComponent implements OnInit, Tab {
}
ngOnInit() {
this.keymapOptions.push({
id: '-1',
text: 'Switch to keymap'
});
this.keymapOptions = this.keymaps.map((keymap: Keymap): Select2OptionData => {
return {
id: keymap.abbreviation,
@@ -36,6 +31,14 @@ export class KeymapTabComponent implements OnInit, Tab {
};
});
this.keymapOptions = [
{
id: '-1',
text: 'Switch to keymap'
},
...this.keymapOptions
];
this.fromKeyAction(this.defaultKeyAction);
}
@@ -56,6 +59,7 @@ export class KeymapTabComponent implements OnInit, Tab {
if (!(keyAction instanceof SwitchKeymapAction)) {
return false;
}
let switchKeymapAction: SwitchKeymapAction = <SwitchKeymapAction>keyAction;
this.selectedKeymap = this.keymaps
.find((keymap: Keymap) => keymap.abbreviation === switchKeymapAction.keymapAbbreviation);