Commit 9e860a3bf8c88b628b63a6f3b99f443cb5b5dbe6

Authored by Artem Halushko
1 parent 9ad09bb5

fixes

@@ -49,6 +49,7 @@ export default abstract class LeafletMap { @@ -49,6 +49,7 @@ export default abstract class LeafletMap {
49 datasources: FormattedData[]; 49 datasources: FormattedData[];
50 markersCluster; 50 markersCluster;
51 points: FeatureGroup; 51 points: FeatureGroup;
  52 + markersData = [];
52 53
53 protected constructor(public $container: HTMLElement, options: UnitedMapSettings) { 54 protected constructor(public $container: HTMLElement, options: UnitedMapSettings) {
54 this.options = options; 55 this.options = options;
@@ -159,9 +160,9 @@ export default abstract class LeafletMap { @@ -159,9 +160,9 @@ export default abstract class LeafletMap {
159 this.map = map; 160 this.map = map;
160 if (this.options.useDefaultCenterPosition) { 161 if (this.options.useDefaultCenterPosition) {
161 this.map.panTo(this.options.defaultCenterPosition); 162 this.map.panTo(this.options.defaultCenterPosition);
162 - // this.bounds = map.getBounds(); 163 + this.bounds = map.getBounds();
163 } 164 }
164 - // else this.bounds = new L.LatLngBounds(null, null); 165 + else this.bounds = new L.LatLngBounds(null, null);
165 if (this.options.draggableMarker) { 166 if (this.options.draggableMarker) {
166 this.addMarkerControl(); 167 this.addMarkerControl();
167 } 168 }
@@ -269,6 +270,7 @@ export default abstract class LeafletMap { @@ -269,6 +270,7 @@ export default abstract class LeafletMap {
269 this.createMarker(data.entityName, data, markersData, this.options as MarkerSettings); 270 this.createMarker(data.entityName, data, markersData, this.options as MarkerSettings);
270 } 271 }
271 }); 272 });
  273 + this.markersData = markersData;
272 } 274 }
273 275
274 dragMarker = (e, data?) => { 276 dragMarker = (e, data?) => {
@@ -128,6 +128,7 @@ export type PolygonSettings = { @@ -128,6 +128,7 @@ export type PolygonSettings = {
128 polygonTooltipPattern: string; 128 polygonTooltipPattern: string;
129 usePolygonTooltipFunction: boolean; 129 usePolygonTooltipFunction: boolean;
130 polygonClick: { [name: string]: actionsHandler }; 130 polygonClick: { [name: string]: actionsHandler };
  131 + usePolygonColorFunction: boolean;
131 polygonTooltipFunction: GenericFunction; 132 polygonTooltipFunction: GenericFunction;
132 polygonColorFunction?: GenericFunction; 133 polygonColorFunction?: GenericFunction;
133 } 134 }
@@ -72,9 +72,9 @@ export class Polygon { @@ -72,9 +72,9 @@ export class Polygon {
72 this.map.removeLayer(this.leafletPoly); 72 this.map.removeLayer(this.leafletPoly);
73 } 73 }
74 74
75 - updatePolygonColor(settings) { 75 + updatePolygonColor(settings: PolygonSettings) {
76 const color = settings.usePolygonColorFunction ? 76 const color = settings.usePolygonColorFunction ?
77 - safeExecute(settings.polygoncolorFunction, [this.data, this.dataSources, this.data.dsIndex]) : settings.polygonColor; 77 + safeExecute(settings.polygonColorFunction, [this.data, this.dataSources, this.data.dsIndex]) : settings.polygonColor;
78 const style: L.PathOptions = { 78 const style: L.PathOptions = {
79 fill: true, 79 fill: true,
80 fillColor: color, 80 fillColor: color,
@@ -108,6 +108,7 @@ export class ImageMap extends LeafletMap { @@ -108,6 +108,7 @@ export class ImageMap extends LeafletMap {
108 lastCenterPos.y /= prevHeight; 108 lastCenterPos.y /= prevHeight;
109 this.updateBounds(updateImage, lastCenterPos); 109 this.updateBounds(updateImage, lastCenterPos);
110 this.map.invalidateSize(true); 110 this.map.invalidateSize(true);
  111 + this.updateMarkers(this.markersData);
111 } 112 }
112 } 113 }
113 } 114 }