Use ids in key actions instead of references (#239)

Partially reverts e48fdea
This commit is contained in:
József Farkas
2016-12-30 11:51:46 +01:00
committed by GitHub
parent 6a7efcc2b1
commit 9b2aa188e6
13 changed files with 165 additions and 164 deletions

View File

@@ -59,7 +59,8 @@ export class KeymapTabComponent implements OnInit, OnChanges, Tab {
}
const switchKeymapAction: SwitchKeymapAction = <SwitchKeymapAction>keyAction;
this.selectedKeymap = switchKeymapAction.keymap;
this.selectedKeymap = this.keymaps
.find((keymap: Keymap) => keymap.abbreviation === switchKeymapAction.keymapAbbreviation);
}
toKeyAction(): SwitchKeymapAction {
@@ -68,7 +69,7 @@ export class KeymapTabComponent implements OnInit, OnChanges, Tab {
}
const keymapAction = new SwitchKeymapAction();
keymapAction.keymap = this.selectedKeymap;
keymapAction.keymapAbbreviation = this.selectedKeymap.abbreviation;
return keymapAction;
}
}

View File

@@ -61,7 +61,7 @@ export class MacroTabComponent implements OnInit, OnChanges, OnDestroy, Tab {
return false;
}
const playMacroAction: PlayMacroAction = <PlayMacroAction>keyAction;
this.selectedMacroIndex = this.macros.findIndex(macro => playMacroAction.macro === macro);
this.selectedMacroIndex = this.macros.findIndex(macro => playMacroAction.macroId === macro.id);
return true;
}
@@ -71,7 +71,7 @@ export class MacroTabComponent implements OnInit, OnChanges, OnDestroy, Tab {
}
const keymapAction = new PlayMacroAction();
keymapAction.macro = this.macros[this.selectedMacroIndex];
keymapAction.macroId = this.macros[this.selectedMacroIndex].id;
return keymapAction;
}