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 c332ed5765..69226317ce 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 @@ -42,6 +42,7 @@ import { Polygon } from './polygon'; import { createTooltip, parseArray, safeExecute } from '@home/components/widget/lib/maps/maps-utils'; import { WidgetContext } from '@home/models/widget-component.models'; import { DatasourceData } from '@shared/models/widget.models'; +import { deepClone } from '@core/utils'; export default abstract class LeafletMap { @@ -57,6 +58,7 @@ export default abstract class LeafletMap { markersCluster: MarkerClusterGroup; points: FeatureGroup; markersData: FormattedData[] = []; + polygonsData: FormattedData[] = []; protected constructor(public ctx: WidgetContext, public $container: HTMLElement, @@ -480,6 +482,7 @@ export default abstract class LeafletMap { updatePolygons(polyData: FormattedData[], updateBounds = true) { const keys: string[] = []; + this.polygonsData = deepClone(polyData); polyData.forEach((data: FormattedData) => { if (data && data.hasOwnProperty(this.options.polygonKeyName) && data[this.options.polygonKeyName] !== null) { if (typeof (data[this.options.polygonKeyName]) === 'string') { 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 9f97aed2ac..b4f5726c32 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 @@ -184,6 +184,7 @@ export class ImageMap extends LeafletMap { this.updateBounds(updateImage, lastCenterPos); this.map.invalidateSize(true); this.updateMarkers(this.markersData); + this.updatePolygons(this.polygonsData); } } }