Browse Source

fix empty center position & fix entity id

pull/2720/head
Artem Halushko 6 years ago
parent
commit
cd88afea00
  1. 11
      ui-ngx/src/app/modules/home/components/widget/lib/maps/leaflet-map.ts
  2. 9
      ui-ngx/src/app/modules/home/components/widget/lib/maps/map-widget2.ts

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

@ -198,9 +198,15 @@ export default abstract class LeafletMap {
fitBounds(bounds: LatLngBounds, useDefaultZoom = false, padding?: LatLngTuple) {
if (bounds.isValid()) {
if ((!this.options.fitMapBounds || this.options.useDefaultCenterPosition) && this.options.defaultZoomLevel) {
this.bounds = this.bounds.extend(bounds);
if (!this.options.fitMapBounds && this.options.defaultZoomLevel) {
this.map.setZoom(this.options.defaultZoomLevel, { animate: false });
this.map.panTo(this.options.defaultCenterPosition, { animate: false });
if (this.options.useDefaultCenterPosition) {
this.map.panTo(this.options.defaultCenterPosition, { animate: false });
}
else {
this.map.panTo(this.bounds.getCenter());
}
} else {
this.map.once('zoomend', () => {
if (!this.options.defaultZoomLevel && this.map.getZoom() > this.options.minZoomLevel) {
@ -212,7 +218,6 @@ export default abstract class LeafletMap {
}
this.map.fitBounds(bounds, { padding: padding || [50, 50], animate: false });
}
this.bounds = bounds;
}
}

9
ui-ngx/src/app/modules/home/components/widget/lib/maps/map-widget2.ts

@ -154,12 +154,11 @@ export class MapWidgetController implements MapWidgetInterface {
if ($event && $event.stopPropagation) {
$event?.stopPropagation();
}
const { id, entityName, entityLabel, entityType } = entityInfo;
const entityId: EntityId = {
const { entityId, entityName, entityLabel, entityType } = entityInfo;
this.ctx.actionsApi.handleWidgetAction($event, descriptor, {
entityType,
id
};
this.ctx.actionsApi.handleWidgetAction($event, descriptor, entityId, entityName, null, entityLabel);
id: entityId
}, entityName, null, entityLabel);
}
setMarkerLocation = (e) => {

Loading…
Cancel
Save