Commit c94b4e1d69f0c3577fa2e7be0161bc26667016c1

Authored by Vladyslav_Prykhodko
1 parent fc597f2c

Fix: resize polygons for image map

... ... @@ -42,6 +42,7 @@ import { Polygon } from './polygon';
42 42 import { createTooltip, parseArray, safeExecute } from '@home/components/widget/lib/maps/maps-utils';
43 43 import { WidgetContext } from '@home/models/widget-component.models';
44 44 import { DatasourceData } from '@shared/models/widget.models';
  45 +import { deepClone } from '@core/utils';
45 46
46 47 export default abstract class LeafletMap {
47 48
... ... @@ -57,6 +58,7 @@ export default abstract class LeafletMap {
57 58 markersCluster: MarkerClusterGroup;
58 59 points: FeatureGroup;
59 60 markersData: FormattedData[] = [];
  61 + polygonsData: FormattedData[] = [];
60 62
61 63 protected constructor(public ctx: WidgetContext,
62 64 public $container: HTMLElement,
... ... @@ -480,6 +482,7 @@ export default abstract class LeafletMap {
480 482
481 483 updatePolygons(polyData: FormattedData[], updateBounds = true) {
482 484 const keys: string[] = [];
  485 + this.polygonsData = deepClone(polyData);
483 486 polyData.forEach((data: FormattedData) => {
484 487 if (data && data.hasOwnProperty(this.options.polygonKeyName) && data[this.options.polygonKeyName] !== null) {
485 488 if (typeof (data[this.options.polygonKeyName]) === 'string') {
... ...
... ... @@ -184,6 +184,7 @@ export class ImageMap extends LeafletMap {
184 184 this.updateBounds(updateImage, lastCenterPos);
185 185 this.map.invalidateSize(true);
186 186 this.updateMarkers(this.markersData);
  187 + this.updatePolygons(this.polygonsData);
187 188 }
188 189 }
189 190 }
... ...