diff --git a/projects/project-3/frontend/src/app/service/map.service.ts b/projects/project-3/frontend/src/app/service/map.service.ts index aad157d..daee81b 100644 --- a/projects/project-3/frontend/src/app/service/map.service.ts +++ b/projects/project-3/frontend/src/app/service/map.service.ts @@ -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 {