Commit 9e860a3bf8c88b628b63a6f3b99f443cb5b5dbe6

Authored by Artem Halushko
1 parent 9ad09bb5

fixes

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