From 690784c0e6422586e2ce566fff228b1051b75ea0 Mon Sep 17 00:00:00 2001 From: Artem Halushko Date: Thu, 21 May 2020 18:43:25 +0300 Subject: [PATCH] trip animation update fix --- .../trip-animation/trip-animation.component.ts | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) 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 24f2541caf..6b127e7725 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 @@ -140,7 +140,7 @@ export class TripAnimationComponent implements OnInit, AfterViewInit { } } this.calcLabel(); - this.calcTooltip(); + this.calcTooltip(currentPosition.find(position => position.entityName === this.activeTrip.entityName)); if (this.mapWidget) { this.mapWidget.map.updatePolylines(this.interpolatedTimeData.map(ds => _.values(ds)), this.activeTrip); if (this.settings.showPolygon) { @@ -175,19 +175,14 @@ export class TripAnimationComponent implements OnInit, AfterViewInit { } } - calcTooltip = (point?: FormattedData, setTooltip = true) => { - if (!point) { - point = this.activeTrip; - } - const data = this.activeTrip; + calcTooltip = (point?: FormattedData) => { + const data = point ? point : this.activeTrip; const tooltipPattern: string = this.settings.useTooltipFunction ? safeExecute(this.settings.tooolTipFunction, [data, this.historicalData, point.dsIndex]) : this.settings.tooltipPattern; const tooltipText = parseWithTranslation.parseTemplate(tooltipPattern, data, true); - if (setTooltip) { - this.mainTooltip = this.sanitizer.sanitize( - SecurityContext.HTML, tooltipText); - this.cd.detectChanges(); - } + this.mainTooltip = this.sanitizer.sanitize( + SecurityContext.HTML, tooltipText); + this.cd.detectChanges(); this.activeTrip = point; return tooltipText; }