Skip to content
Snippets Groups Projects
Commit a113d7b4 authored by AndiMajore's avatar AndiMajore
Browse files

merged, fixed legend dividerbars

parents 61573452 e03acd2f
No related branches found
No related tags found
No related merge requests found
<div
class="legend"
[class.right]="this.config.legendPos === 'right'"
[class.right]="config.legendPos === 'right'"
[ngClass]="{ 'legend-small': drugstoneConfig.smallStyle }"
>
<div class="legend-background"></div>
<!-- default legend in html -->
<table *ngIf="!this.config.legendUrl.length" class="legend-table">
<ng-container *ngIf="this.config.showLegendNodes">
<ng-container *ngFor="let nodeGroup of this.config.nodeGroups | keyvalue">
<table *ngIf="!config.legendUrl.length" class="legend-table">
<ng-container *ngIf="config.showLegendNodes">
<ng-container *ngFor="let nodeGroup of config.nodeGroups | keyvalue">
<tr
class="list-item"
*ngIf="nodeGroup.key && checkNodeGroupContext(nodeGroup.key)"
......@@ -86,9 +86,9 @@
</ng-container>
</ng-container>
<ng-container *ngIf="this.config.showLegendEdges">
<ng-container *ngIf="config.showLegendEdges && _emptyEdgeConfig">
<tr
*ngFor="let edgeGroup of this.config.edgeGroups | keyvalue"
*ngFor="let edgeGroup of config.edgeGroups | keyvalue"
class="list-item"
>
<ng-container
......@@ -114,8 +114,8 @@
<!-- custom legend image if url given by user -->
<img
*ngIf="this.config.legendUrl.length"
[src]="this.config.legendUrl"
[ngClass]="this.config.legendClass"
*ngIf="config.legendUrl.length"
[src]="config.legendUrl"
[ngClass]="config.legendClass"
/>
</div>
......@@ -10,7 +10,12 @@ import {IConfig} from '../../../config';
})
export class NetworkLegendComponent implements OnInit {
@Input() context: LegendContext;
_context = 'explorer';
_emptyEdgeConfig = false;
@Input() set context (value: LegendContext) {
this._context = value;
this._emptyEdgeConfig = this.checkIfEdgeConfigEmpty();
};
@Input() config: IConfig;
private contextNodeGroupsToDelete = {
......@@ -40,11 +45,15 @@ export class NetworkLegendComponent implements OnInit {
// selected node is not supposed to appear in legend
return false;
}
return !this.contextNodeGroupsToDelete[this.context].includes(nodeGroupKey);
return !this.contextNodeGroupsToDelete[this._context].includes(nodeGroupKey);
}
public checkEdgeGroupContext(edgeGroupKey) {
return !this.contextEdgeGroupsToDelete[this.context].includes(edgeGroupKey);
return !this.contextEdgeGroupsToDelete[this._context].includes(edgeGroupKey);
}
public checkIfEdgeConfigEmpty() {
return Object.keys(this.config.edgeGroups).some(key => this.checkEdgeGroupContext(key));
}
constructor(public drugstoneConfig: DrugstoneConfigService) { }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment