Fixes after review

This commit is contained in:
Dmitriymush 2020-12-16 17:36:08 +02:00
parent 235946691b
commit 96ff9ddedd
4 changed files with 13 additions and 11 deletions

View File

@ -629,7 +629,7 @@ export default abstract class LeafletMap {
} }
this.points.addLayer(point); this.points.addLayer(point);
}); });
if(i === 0) { if(i === (pointsData.length - 1)) {
this.map.addLayer(this.points); this.map.addLayer(this.points);
} }
} }

View File

@ -32,7 +32,7 @@
[ngStyle]="{'background-color': settings.tooltipColor, 'opacity': settings.tooltipOpacity, 'color': settings.tooltipFontColor}"> [ngStyle]="{'background-color': settings.tooltipColor, 'opacity': settings.tooltipOpacity, 'color': settings.tooltipFontColor}">
<div *ngFor="let mainTooltip of mainTooltips" <div *ngFor="let mainTooltip of mainTooltips"
[innerHTML]="mainTooltip" [innerHTML]="mainTooltip"
[ngStyle]="{'padding': '10px 0'}"> ngStyle="{'padding': '10px 0'}">
</div> </div>
</div> </div>
</div> </div>

View File

@ -73,6 +73,9 @@
} }
.trip-animation-tooltip { .trip-animation-tooltip {
display: flex;
overflow: auto;
max-height: 90%;
position: absolute; position: absolute;
top: 30px; top: 30px;
right: 0; right: 0;
@ -86,4 +89,4 @@
} }
} }
} }
} }

View File

@ -141,7 +141,7 @@ export class TripAnimationComponent implements OnInit, AfterViewInit, OnDestroy
timeUpdated(time: number) { timeUpdated(time: number) {
this.currentTime = time; this.currentTime = time;
let currentPosition = this.interpolatedTimeData const currentPosition = this.interpolatedTimeData
.map(dataSource => dataSource[time]) .map(dataSource => dataSource[time])
for(let j = 0; j < this.interpolatedTimeData.length; j++) { for(let j = 0; j < this.interpolatedTimeData.length; j++) {
if (isUndefined(currentPosition[j])) { if (isUndefined(currentPosition[j])) {
@ -175,7 +175,7 @@ export class TripAnimationComponent implements OnInit, AfterViewInit, OnDestroy
this.mapWidget.map.updatePolygons(this.interpolatedTimeData); this.mapWidget.map.updatePolygons(this.interpolatedTimeData);
} }
if (this.settings.showPoints) { if (this.settings.showPoints) {
this.mapWidget.map.updatePoints(formattedInterpolatedTimeData, this.calcTooltip); this.mapWidget.map.updatePoints(formattedInterpolatedTimeData.map(ds => _.union(ds)), this.calcTooltip);
} }
this.mapWidget.map.updateMarkers(currentPosition, true, (trip) => { this.mapWidget.map.updateMarkers(currentPosition, true, (trip) => {
this.activeTrip = trip; this.activeTrip = trip;
@ -235,20 +235,19 @@ export class TripAnimationComponent implements OnInit, AfterViewInit, OnDestroy
this.mainTooltips.push(this.sanitizer.sanitize(SecurityContext.HTML, tooltipText)); this.mainTooltips.push(this.sanitizer.sanitize(SecurityContext.HTML, tooltipText));
} }
this.cd.detectChanges(); this.cd.detectChanges();
this.activeTrip = point;
} }
return tooltipText; return tooltipText;
} }
calcLabel(formattedDataArr: FormattedData[]) { calcLabel(formattedDataArr: FormattedData[]) {
this.label = ''; let labelToSet = '';
for (let formattedData of formattedDataArr) { for (let formattedData of formattedDataArr) {
const data = formattedData;
const labelText: string = this.settings.useLabelFunction ? const labelText: string = this.settings.useLabelFunction ?
safeExecute(this.settings.labelFunction, [data, this.historicalData, data.dsIndex]) : this.settings.label; safeExecute(this.settings.labelFunction, [formattedData, this.historicalData, formattedData.dsIndex]) : this.settings.label;
const label = (parseWithTranslation.parseTemplate(labelText, data, true)); const label = (parseWithTranslation.parseTemplate(labelText, formattedData, true));
this.label = this.label.length ? this.label + ',' + label : label; labelToSet = labelToSet.length ? labelToSet + ',' + label : label;
} }
this.label = labelToSet;
} }
interpolateArray(originData: FormattedData[]) { interpolateArray(originData: FormattedData[]) {