Throw error in layer tab when it is not usable

This commit is contained in:
Farkas József
2016-12-16 16:46:14 +01:00
parent 31492da0a2
commit 356482f9e9

View File

@@ -60,7 +60,7 @@ export class LayerTabComponent implements OnChanges, Tab {
} }
keyActionValid(): boolean { keyActionValid(): boolean {
return true; return !this.isNotBase;
} }
fromKeyAction(keyAction: KeyAction): boolean { fromKeyAction(keyAction: KeyAction): boolean {
@@ -78,6 +78,9 @@ export class LayerTabComponent implements OnChanges, Tab {
let keyAction = new SwitchLayerAction(); let keyAction = new SwitchLayerAction();
keyAction.isLayerToggleable = this.toggle; keyAction.isLayerToggleable = this.toggle;
keyAction.layer = this.layer; keyAction.layer = this.layer;
if (!this.keyActionValid()) {
throw new Error('KeyAction is invalid!');
}
return keyAction; return keyAction;
} }