Fix: resize polygons for image map
This commit is contained in:
parent
fc597f2c0b
commit
c94b4e1d69
@ -42,6 +42,7 @@ import { Polygon } from './polygon';
|
|||||||
import { createTooltip, parseArray, safeExecute } from '@home/components/widget/lib/maps/maps-utils';
|
import { createTooltip, parseArray, safeExecute } from '@home/components/widget/lib/maps/maps-utils';
|
||||||
import { WidgetContext } from '@home/models/widget-component.models';
|
import { WidgetContext } from '@home/models/widget-component.models';
|
||||||
import { DatasourceData } from '@shared/models/widget.models';
|
import { DatasourceData } from '@shared/models/widget.models';
|
||||||
|
import { deepClone } from '@core/utils';
|
||||||
|
|
||||||
export default abstract class LeafletMap {
|
export default abstract class LeafletMap {
|
||||||
|
|
||||||
@ -57,6 +58,7 @@ export default abstract class LeafletMap {
|
|||||||
markersCluster: MarkerClusterGroup;
|
markersCluster: MarkerClusterGroup;
|
||||||
points: FeatureGroup;
|
points: FeatureGroup;
|
||||||
markersData: FormattedData[] = [];
|
markersData: FormattedData[] = [];
|
||||||
|
polygonsData: FormattedData[] = [];
|
||||||
|
|
||||||
protected constructor(public ctx: WidgetContext,
|
protected constructor(public ctx: WidgetContext,
|
||||||
public $container: HTMLElement,
|
public $container: HTMLElement,
|
||||||
@ -480,6 +482,7 @@ export default abstract class LeafletMap {
|
|||||||
|
|
||||||
updatePolygons(polyData: FormattedData[], updateBounds = true) {
|
updatePolygons(polyData: FormattedData[], updateBounds = true) {
|
||||||
const keys: string[] = [];
|
const keys: string[] = [];
|
||||||
|
this.polygonsData = deepClone(polyData);
|
||||||
polyData.forEach((data: FormattedData) => {
|
polyData.forEach((data: FormattedData) => {
|
||||||
if (data && data.hasOwnProperty(this.options.polygonKeyName) && data[this.options.polygonKeyName] !== null) {
|
if (data && data.hasOwnProperty(this.options.polygonKeyName) && data[this.options.polygonKeyName] !== null) {
|
||||||
if (typeof (data[this.options.polygonKeyName]) === 'string') {
|
if (typeof (data[this.options.polygonKeyName]) === 'string') {
|
||||||
|
|||||||
@ -184,6 +184,7 @@ export class ImageMap extends LeafletMap {
|
|||||||
this.updateBounds(updateImage, lastCenterPos);
|
this.updateBounds(updateImage, lastCenterPos);
|
||||||
this.map.invalidateSize(true);
|
this.map.invalidateSize(true);
|
||||||
this.updateMarkers(this.markersData);
|
this.updateMarkers(this.markersData);
|
||||||
|
this.updatePolygons(this.polygonsData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user