...
|
...
|
@@ -19,12 +19,14 @@ import _ from 'lodash'; |
19
|
19
|
import tinycolor from "tinycolor2";
|
20
|
20
|
import { interpolateOnPointSegment } from 'leaflet-geometryutil';
|
21
|
21
|
|
22
|
|
-import { Component, OnInit, Input, ViewChild, AfterViewInit, ChangeDetectorRef } from '@angular/core';
|
|
22
|
+import { Component, OnInit, Input, ViewChild, AfterViewInit, ChangeDetectorRef, SecurityContext } from '@angular/core';
|
23
|
23
|
import { MapWidgetController, TbMapWidgetV2 } from '../lib/maps/map-widget2';
|
24
|
24
|
import { MapProviders } from '../lib/maps/map-models';
|
25
|
|
-import { parseArray } from '@app/core/utils';
|
|
25
|
+import { parseArray, parseTemplate, safeExecute } from '@app/core/utils';
|
26
|
26
|
import { initSchema, addToSchema, addGroupInfo } from '@app/core/schema-utils';
|
27
|
27
|
import { tripAnimationSchema } from '../lib/maps/schemes';
|
|
28
|
+import { DomSanitizer } from '@angular/platform-browser';
|
|
29
|
+import { WidgetConfig } from '@app/shared/public-api';
|
28
|
30
|
|
29
|
31
|
|
30
|
32
|
@Component({
|
...
|
...
|
@@ -34,7 +36,7 @@ import { tripAnimationSchema } from '../lib/maps/schemes'; |
34
|
36
|
})
|
35
|
37
|
export class TripAnimationComponent implements OnInit, AfterViewInit {
|
36
|
38
|
|
37
|
|
- @Input() ctx;
|
|
39
|
+ @Input() ctx: WidgetConfig;
|
38
|
40
|
|
39
|
41
|
@ViewChild('map') mapContainer;
|
40
|
42
|
|
...
|
...
|
@@ -45,10 +47,11 @@ export class TripAnimationComponent implements OnInit, AfterViewInit { |
45
|
47
|
interpolatedData = [];
|
46
|
48
|
widgetConfig;
|
47
|
49
|
settings;
|
48
|
|
- mainTooltip;
|
|
50
|
+ mainTooltip = '';
|
|
51
|
+ visibleTooltip = false;
|
49
|
52
|
activeTrip;
|
50
|
53
|
|
51
|
|
- constructor(private cd: ChangeDetectorRef) { }
|
|
54
|
+ constructor(private cd: ChangeDetectorRef,private sanitizer: DomSanitizer) { }
|
52
|
55
|
|
53
|
56
|
ngOnInit(): void {
|
54
|
57
|
this.widgetConfig = this.ctx.widgetConfig;
|
...
|
...
|
@@ -74,6 +77,7 @@ export class TripAnimationComponent implements OnInit, AfterViewInit { |
74
|
77
|
ngAfterViewInit() {
|
75
|
78
|
let ctxCopy = _.cloneDeep(this.ctx);
|
76
|
79
|
ctxCopy.settings.showLabel = false;
|
|
80
|
+ ctxCopy.settings.showTooltip = false;
|
77
|
81
|
this.mapWidget = new MapWidgetController(MapProviders.openstreet, false, ctxCopy, this.mapContainer.nativeElement);
|
78
|
82
|
}
|
79
|
83
|
|
...
|
...
|
@@ -99,6 +103,10 @@ export class TripAnimationComponent implements OnInit, AfterViewInit { |
99
|
103
|
}
|
100
|
104
|
|
101
|
105
|
showHideTooltip() {
|
|
106
|
+ console.log(this.activeTrip);
|
|
107
|
+ let tooltipText: string = this.settings.useTooltipFunction ? safeExecute(this.settings.tooolTipFunction) :
|
|
108
|
+ // this.mainTooltip = this.sanitizer.sanitize(SecurityContext.HTML, parseTemplate(tooltipText, this.activeTrip))
|
|
109
|
+ this.visibleTooltip = !this.visibleTooltip;
|
102
|
110
|
}
|
103
|
111
|
|
104
|
112
|
interpolateArray(originData, interpolatedIntervals) {
|
...
|
...
|
|