Browse Source

fixes

pull/2738/head
Artem Halushko 6 years ago
parent
commit
9e860a3bf8
  1. 6
      ui-ngx/src/app/modules/home/components/widget/lib/maps/leaflet-map.ts
  2. 1
      ui-ngx/src/app/modules/home/components/widget/lib/maps/map-models.ts
  3. 4
      ui-ngx/src/app/modules/home/components/widget/lib/maps/polygon.ts
  4. 1
      ui-ngx/src/app/modules/home/components/widget/lib/maps/providers/image-map.ts

6
ui-ngx/src/app/modules/home/components/widget/lib/maps/leaflet-map.ts

@ -49,6 +49,7 @@ export default abstract class LeafletMap {
datasources: FormattedData[]; datasources: FormattedData[];
markersCluster; markersCluster;
points: FeatureGroup; points: FeatureGroup;
markersData = [];
protected constructor(public $container: HTMLElement, options: UnitedMapSettings) { protected constructor(public $container: HTMLElement, options: UnitedMapSettings) {
this.options = options; this.options = options;
@ -159,9 +160,9 @@ export default abstract class LeafletMap {
this.map = map; this.map = map;
if (this.options.useDefaultCenterPosition) { if (this.options.useDefaultCenterPosition) {
this.map.panTo(this.options.defaultCenterPosition); this.map.panTo(this.options.defaultCenterPosition);
// this.bounds = map.getBounds(); this.bounds = map.getBounds();
} }
// else this.bounds = new L.LatLngBounds(null, null); else this.bounds = new L.LatLngBounds(null, null);
if (this.options.draggableMarker) { if (this.options.draggableMarker) {
this.addMarkerControl(); this.addMarkerControl();
} }
@ -269,6 +270,7 @@ export default abstract class LeafletMap {
this.createMarker(data.entityName, data, markersData, this.options as MarkerSettings); this.createMarker(data.entityName, data, markersData, this.options as MarkerSettings);
} }
}); });
this.markersData = markersData;
} }
dragMarker = (e, data?) => { dragMarker = (e, data?) => {

1
ui-ngx/src/app/modules/home/components/widget/lib/maps/map-models.ts

@ -128,6 +128,7 @@ export type PolygonSettings = {
polygonTooltipPattern: string; polygonTooltipPattern: string;
usePolygonTooltipFunction: boolean; usePolygonTooltipFunction: boolean;
polygonClick: { [name: string]: actionsHandler }; polygonClick: { [name: string]: actionsHandler };
usePolygonColorFunction: boolean;
polygonTooltipFunction: GenericFunction; polygonTooltipFunction: GenericFunction;
polygonColorFunction?: GenericFunction; polygonColorFunction?: GenericFunction;
} }

4
ui-ngx/src/app/modules/home/components/widget/lib/maps/polygon.ts

@ -72,9 +72,9 @@ export class Polygon {
this.map.removeLayer(this.leafletPoly); this.map.removeLayer(this.leafletPoly);
} }
updatePolygonColor(settings) { updatePolygonColor(settings: PolygonSettings) {
const color = settings.usePolygonColorFunction ? const color = settings.usePolygonColorFunction ?
safeExecute(settings.polygoncolorFunction, [this.data, this.dataSources, this.data.dsIndex]) : settings.polygonColor; safeExecute(settings.polygonColorFunction, [this.data, this.dataSources, this.data.dsIndex]) : settings.polygonColor;
const style: L.PathOptions = { const style: L.PathOptions = {
fill: true, fill: true,
fillColor: color, fillColor: color,

1
ui-ngx/src/app/modules/home/components/widget/lib/maps/providers/image-map.ts

@ -108,6 +108,7 @@ export class ImageMap extends LeafletMap {
lastCenterPos.y /= prevHeight; lastCenterPos.y /= prevHeight;
this.updateBounds(updateImage, lastCenterPos); this.updateBounds(updateImage, lastCenterPos);
this.map.invalidateSize(true); this.map.invalidateSize(true);
this.updateMarkers(this.markersData);
} }
} }
} }

Loading…
Cancel
Save