dynamically add and remove legend with checkbox-toggle

This commit is contained in:
tim-herbst 2021-01-03 14:45:14 +01:00
parent 210061442f
commit 8ef1b34c3b

View File

@ -155,9 +155,13 @@ export class MapService {
marker.on('mouseout', e => e.target.closePopup());
this.drawLineOnMiniMap(marker, point);
this.markerLayer.push(marker);
this.miniMap.fitBounds(L.featureGroup([...this.markerLayer, this.dashBoardMarker]).getBounds());
this.miniMap.fitBounds(L.featureGroup([this.dashBoardMarker, ...this.markerLayer]).getBounds());
}
if (this.polylineLayer.length === 0) {
this.legend.remove();
} else {
this.drawLegend();
}
this.drawLegend();
}
drawLegend(): void {