Showing
4 changed files
with
21 additions
and
9 deletions
@@ -92,7 +92,7 @@ export default abstract class LeafletMap { | @@ -92,7 +92,7 @@ export default abstract class LeafletMap { | ||
92 | L.control['addmarker']({ position: 'topright' }).addTo(this.map); | 92 | L.control['addmarker']({ position: 'topright' }).addTo(this.map); |
93 | } | 93 | } |
94 | 94 | ||
95 | - inited() { | 95 | + inited() {///!!!! |
96 | return !!this.map; | 96 | return !!this.map; |
97 | } | 97 | } |
98 | 98 |
@@ -34,6 +34,8 @@ import { parseFunction, parseArray, parseData } from '@app/core/utils'; | @@ -34,6 +34,8 @@ import { parseFunction, parseArray, parseData } from '@app/core/utils'; | ||
34 | import { initSchema, addToSchema, mergeSchemes, addCondition, addGroupInfo } from '@app/core/schema-utils'; | 34 | import { initSchema, addToSchema, mergeSchemes, addCondition, addGroupInfo } from '@app/core/schema-utils'; |
35 | import { AttributeScope, EntityId } from '@app/shared/public-api'; | 35 | import { AttributeScope, EntityId } from '@app/shared/public-api'; |
36 | import { forkJoin } from 'rxjs'; | 36 | import { forkJoin } from 'rxjs'; |
37 | +import { WidgetContext } from '@app/modules/home/models/widget-component.models'; | ||
38 | +import { AttributeService } from '@app/core/public-api'; | ||
37 | 39 | ||
38 | export class MapWidgetController implements MapWidgetInterface { | 40 | export class MapWidgetController implements MapWidgetInterface { |
39 | 41 | ||
@@ -43,7 +45,7 @@ export class MapWidgetController implements MapWidgetInterface { | @@ -43,7 +45,7 @@ export class MapWidgetController implements MapWidgetInterface { | ||
43 | data; | 45 | data; |
44 | settings; | 46 | settings; |
45 | 47 | ||
46 | - constructor(public mapProvider: MapProviders, private drawRoutes, public ctx, $element) { | 48 | + constructor(public mapProvider: MapProviders, private drawRoutes, public ctx: WidgetContext, $element) { |
47 | if (this.map) { | 49 | if (this.map) { |
48 | this.map.map.remove(); | 50 | this.map.map.remove(); |
49 | delete this.map; | 51 | delete this.map; |
@@ -67,6 +69,8 @@ export class MapWidgetController implements MapWidgetInterface { | @@ -67,6 +69,8 @@ export class MapWidgetController implements MapWidgetInterface { | ||
67 | } | 69 | } |
68 | 70 | ||
69 | setMarkerLocation = (e) => { | 71 | setMarkerLocation = (e) => { |
72 | + let s = this.ctx.$injector.get(AttributeService); | ||
73 | + console.log("MapWidgetController -> setMarkerLocation -> s", s, s.saveEntityAttributes) | ||
70 | let attributeService = this.ctx.$scope.$injector.get(this.ctx.servicesMap.get('attributeService')); | 74 | let attributeService = this.ctx.$scope.$injector.get(this.ctx.servicesMap.get('attributeService')); |
71 | forkJoin( | 75 | forkJoin( |
72 | this.data.filter(data => !!e[data.dataKey.name]) | 76 | this.data.filter(data => !!e[data.dataKey.name]) |
@@ -17,7 +17,7 @@ | @@ -17,7 +17,7 @@ | ||
17 | --> | 17 | --> |
18 | <div class="trip-animation-widget"> | 18 | <div class="trip-animation-widget"> |
19 | <div class="trip-animation-label-container" *ngIf="settings.showLabel"> | 19 | <div class="trip-animation-label-container" *ngIf="settings.showLabel"> |
20 | - {{settings.label | tbParseTemplate: activeTrip}} | 20 | + {{settings.label | tbParseTemplate: activeTrip}} |
21 | </div> | 21 | </div> |
22 | <div class="trip-animation-container" layout="column"> | 22 | <div class="trip-animation-container" layout="column"> |
23 | <div class="map" #map></div> | 23 | <div class="map" #map></div> |
@@ -28,7 +28,7 @@ | @@ -28,7 +28,7 @@ | ||
28 | </button> | 28 | </button> |
29 | </div> | 29 | </div> |
30 | <div class="trip-animation-tooltip md-whiteframe-z4" layout="column" | 30 | <div class="trip-animation-tooltip md-whiteframe-z4" layout="column" |
31 | - [ngClass]="{ 'trip-animation-tooltip-hidden':!settings.showTooltip}" [innerHTML]="mainTooltip" | 31 | + [ngClass]="{'trip-animation-tooltip-hidden':!visibleTooltip}" [innerHTML]="mainTooltip" |
32 | [ngStyle]="{'background-color': settings.tooltipColor, 'opacity': settings.tooltipOpacity, 'color': settings.tooltipFontColor}"> | 32 | [ngStyle]="{'background-color': settings.tooltipColor, 'opacity': settings.tooltipOpacity, 'color': settings.tooltipFontColor}"> |
33 | </div> | 33 | </div> |
34 | </div> | 34 | </div> |
@@ -19,12 +19,14 @@ import _ from 'lodash'; | @@ -19,12 +19,14 @@ import _ from 'lodash'; | ||
19 | import tinycolor from "tinycolor2"; | 19 | import tinycolor from "tinycolor2"; |
20 | import { interpolateOnPointSegment } from 'leaflet-geometryutil'; | 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 | import { MapWidgetController, TbMapWidgetV2 } from '../lib/maps/map-widget2'; | 23 | import { MapWidgetController, TbMapWidgetV2 } from '../lib/maps/map-widget2'; |
24 | import { MapProviders } from '../lib/maps/map-models'; | 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 | import { initSchema, addToSchema, addGroupInfo } from '@app/core/schema-utils'; | 26 | import { initSchema, addToSchema, addGroupInfo } from '@app/core/schema-utils'; |
27 | import { tripAnimationSchema } from '../lib/maps/schemes'; | 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 | @Component({ | 32 | @Component({ |
@@ -34,7 +36,7 @@ import { tripAnimationSchema } from '../lib/maps/schemes'; | @@ -34,7 +36,7 @@ import { tripAnimationSchema } from '../lib/maps/schemes'; | ||
34 | }) | 36 | }) |
35 | export class TripAnimationComponent implements OnInit, AfterViewInit { | 37 | export class TripAnimationComponent implements OnInit, AfterViewInit { |
36 | 38 | ||
37 | - @Input() ctx; | 39 | + @Input() ctx: WidgetConfig; |
38 | 40 | ||
39 | @ViewChild('map') mapContainer; | 41 | @ViewChild('map') mapContainer; |
40 | 42 | ||
@@ -45,10 +47,11 @@ export class TripAnimationComponent implements OnInit, AfterViewInit { | @@ -45,10 +47,11 @@ export class TripAnimationComponent implements OnInit, AfterViewInit { | ||
45 | interpolatedData = []; | 47 | interpolatedData = []; |
46 | widgetConfig; | 48 | widgetConfig; |
47 | settings; | 49 | settings; |
48 | - mainTooltip; | 50 | + mainTooltip = ''; |
51 | + visibleTooltip = false; | ||
49 | activeTrip; | 52 | activeTrip; |
50 | 53 | ||
51 | - constructor(private cd: ChangeDetectorRef) { } | 54 | + constructor(private cd: ChangeDetectorRef,private sanitizer: DomSanitizer) { } |
52 | 55 | ||
53 | ngOnInit(): void { | 56 | ngOnInit(): void { |
54 | this.widgetConfig = this.ctx.widgetConfig; | 57 | this.widgetConfig = this.ctx.widgetConfig; |
@@ -74,6 +77,7 @@ export class TripAnimationComponent implements OnInit, AfterViewInit { | @@ -74,6 +77,7 @@ export class TripAnimationComponent implements OnInit, AfterViewInit { | ||
74 | ngAfterViewInit() { | 77 | ngAfterViewInit() { |
75 | let ctxCopy = _.cloneDeep(this.ctx); | 78 | let ctxCopy = _.cloneDeep(this.ctx); |
76 | ctxCopy.settings.showLabel = false; | 79 | ctxCopy.settings.showLabel = false; |
80 | + ctxCopy.settings.showTooltip = false; | ||
77 | this.mapWidget = new MapWidgetController(MapProviders.openstreet, false, ctxCopy, this.mapContainer.nativeElement); | 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,6 +103,10 @@ export class TripAnimationComponent implements OnInit, AfterViewInit { | ||
99 | } | 103 | } |
100 | 104 | ||
101 | showHideTooltip() { | 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 | interpolateArray(originData, interpolatedIntervals) { | 112 | interpolateArray(originData, interpolatedIntervals) { |