diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/maps/leaflet-map.ts b/ui-ngx/src/app/modules/home/components/widget/lib/maps/leaflet-map.ts index 91576ec22b..9e7934529d 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/maps/leaflet-map.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/maps/leaflet-map.ts @@ -389,6 +389,9 @@ export default abstract class LeafletMap { const poly = this.polylines.get(name); if (poly) { this.map.removeLayer(poly.leafletPoly); + if (poly.polylineDecorator) { + this.map.removeLayer(poly.polylineDecorator); + } this.polylines.delete(name); } } diff --git a/ui-ngx/src/app/modules/home/components/widget/trip-animation/trip-animation.component.ts b/ui-ngx/src/app/modules/home/components/widget/trip-animation/trip-animation.component.ts index bc22326593..1987889271 100644 --- a/ui-ngx/src/app/modules/home/components/widget/trip-animation/trip-animation.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/trip-animation/trip-animation.component.ts @@ -56,7 +56,6 @@ export class TripAnimationComponent implements OnInit, AfterViewInit { historicalData: FormattedData[][]; normalizationStep: number; interpolatedTimeData = []; - intervals = []; widgetConfig: WidgetConfig; settings; mainTooltip = ''; @@ -104,9 +103,10 @@ export class TripAnimationComponent implements OnInit, AfterViewInit { if (subscription) subscription.callbacks.onDataUpdated = () => { this.historicalData = parseArray(this.ctx.data).filter(arr => arr.length); if (this.historicalData.length) { - this.activeTrip = this.historicalData[0][0]; + if (!this.activeTrip) + this.activeTrip = this.historicalData[0][0]; this.calculateIntervals(); - this.timeUpdated(this.minTime); + this.timeUpdated(this.currentTime ? this.currentTime : this.minTime); } this.mapWidget.map.map?.invalidateSize(); this.cd.detectChanges(); @@ -122,12 +122,7 @@ export class TripAnimationComponent implements OnInit, AfterViewInit { this.currentTime = time; const currentPosition = this.interpolatedTimeData .map(dataSource => dataSource[time]) - .filter(ds => ds) - .map(ds => { - ds.minTime = this.minTimeFormat; - ds.maxTime = this.maxTimeFormat; - return ds; - }); + .filter(ds => ds); if (isUndefined(currentPosition[0])) { const timePoints = Object.keys(this.interpolatedTimeData[0]).map(item => parseInt(item, 10)); for (let i = 1; i < timePoints.length; i++) { @@ -138,6 +133,8 @@ export class TripAnimationComponent implements OnInit, AfterViewInit { currentPosition[0] = { ...beforePosition, time, + minTime: this.minTimeFormat, + maxTime: this.maxTimeFormat, ...interpolateOnLineSegment(beforePosition, afterPosition, this.settings.latKeyName, this.settings.lngKeyName, ratio) } break;