Fixed default keymap selection in popover; Fixed keymap default image
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -26,3 +26,14 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.empty {
|
||||
display: flex;
|
||||
|
||||
img {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: relative;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user