diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/maps/leaflet-map.ts b/ui-ngx/src/app/modules/home/components/widget/lib/maps/leaflet-map.ts index 31db505122..73b859be84 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/maps/leaflet-map.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/maps/leaflet-map.ts @@ -49,6 +49,7 @@ export default abstract class LeafletMap { datasources: FormattedData[]; markersCluster; points: FeatureGroup; + markersData = []; protected constructor(public $container: HTMLElement, options: UnitedMapSettings) { this.options = options; @@ -159,9 +160,9 @@ export default abstract class LeafletMap { this.map = map; if (this.options.useDefaultCenterPosition) { this.map.panTo(this.options.defaultCenterPosition); - // this.bounds = map.getBounds(); + this.bounds = map.getBounds(); } - // else this.bounds = new L.LatLngBounds(null, null); + else this.bounds = new L.LatLngBounds(null, null); if (this.options.draggableMarker) { this.addMarkerControl(); } @@ -269,6 +270,7 @@ export default abstract class LeafletMap { this.createMarker(data.entityName, data, markersData, this.options as MarkerSettings); } }); + this.markersData = markersData; } dragMarker = (e, data?) => { diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/maps/map-models.ts b/ui-ngx/src/app/modules/home/components/widget/lib/maps/map-models.ts index efc78115bc..28e9686bc1 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/maps/map-models.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/maps/map-models.ts @@ -128,6 +128,7 @@ export type PolygonSettings = { polygonTooltipPattern: string; usePolygonTooltipFunction: boolean; polygonClick: { [name: string]: actionsHandler }; + usePolygonColorFunction: boolean; polygonTooltipFunction: GenericFunction; polygonColorFunction?: GenericFunction; } diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/maps/polygon.ts b/ui-ngx/src/app/modules/home/components/widget/lib/maps/polygon.ts index dc6b699dd3..6954d122c2 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/maps/polygon.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/maps/polygon.ts @@ -72,9 +72,9 @@ export class Polygon { this.map.removeLayer(this.leafletPoly); } - updatePolygonColor(settings) { + updatePolygonColor(settings: PolygonSettings) { const color = settings.usePolygonColorFunction ? - safeExecute(settings.polygoncolorFunction, [this.data, this.dataSources, this.data.dsIndex]) : settings.polygonColor; + safeExecute(settings.polygonColorFunction, [this.data, this.dataSources, this.data.dsIndex]) : settings.polygonColor; const style: L.PathOptions = { fill: true, fillColor: color, diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/maps/providers/image-map.ts b/ui-ngx/src/app/modules/home/components/widget/lib/maps/providers/image-map.ts index ff773a9c7c..ae57552cd0 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/maps/providers/image-map.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/maps/providers/image-map.ts @@ -108,6 +108,7 @@ export class ImageMap extends LeafletMap { lastCenterPos.y /= prevHeight; this.updateBounds(updateImage, lastCenterPos); this.map.invalidateSize(true); + this.updateMarkers(this.markersData); } } }