Commit 69f41be5768098ea0ba035cd0e4327dba94569e3

Authored by Artem Halushko
1 parent aac5b0e7

interpolation fix

... ... @@ -389,6 +389,9 @@ export default abstract class LeafletMap {
389 389 const poly = this.polylines.get(name);
390 390 if (poly) {
391 391 this.map.removeLayer(poly.leafletPoly);
  392 + if (poly.polylineDecorator) {
  393 + this.map.removeLayer(poly.polylineDecorator);
  394 + }
392 395 this.polylines.delete(name);
393 396 }
394 397 }
... ...
... ... @@ -56,7 +56,6 @@ export class TripAnimationComponent implements OnInit, AfterViewInit {
56 56 historicalData: FormattedData[][];
57 57 normalizationStep: number;
58 58 interpolatedTimeData = [];
59   - intervals = [];
60 59 widgetConfig: WidgetConfig;
61 60 settings;
62 61 mainTooltip = '';
... ... @@ -104,9 +103,10 @@ export class TripAnimationComponent implements OnInit, AfterViewInit {
104 103 if (subscription) subscription.callbacks.onDataUpdated = () => {
105 104 this.historicalData = parseArray(this.ctx.data).filter(arr => arr.length);
106 105 if (this.historicalData.length) {
107   - this.activeTrip = this.historicalData[0][0];
  106 + if (!this.activeTrip)
  107 + this.activeTrip = this.historicalData[0][0];
108 108 this.calculateIntervals();
109   - this.timeUpdated(this.minTime);
  109 + this.timeUpdated(this.currentTime ? this.currentTime : this.minTime);
110 110 }
111 111 this.mapWidget.map.map?.invalidateSize();
112 112 this.cd.detectChanges();
... ... @@ -122,12 +122,7 @@ export class TripAnimationComponent implements OnInit, AfterViewInit {
122 122 this.currentTime = time;
123 123 const currentPosition = this.interpolatedTimeData
124 124 .map(dataSource => dataSource[time])
125   - .filter(ds => ds)
126   - .map(ds => {
127   - ds.minTime = this.minTimeFormat;
128   - ds.maxTime = this.maxTimeFormat;
129   - return ds;
130   - });
  125 + .filter(ds => ds);
131 126 if (isUndefined(currentPosition[0])) {
132 127 const timePoints = Object.keys(this.interpolatedTimeData[0]).map(item => parseInt(item, 10));
133 128 for (let i = 1; i < timePoints.length; i++) {
... ... @@ -138,6 +133,8 @@ export class TripAnimationComponent implements OnInit, AfterViewInit {
138 133 currentPosition[0] = {
139 134 ...beforePosition,
140 135 time,
  136 + minTime: this.minTimeFormat,
  137 + maxTime: this.maxTimeFormat,
141 138 ...interpolateOnLineSegment(beforePosition, afterPosition, this.settings.latKeyName, this.settings.lngKeyName, ratio)
142 139 }
143 140 break;
... ...