Fix Map fitBounds method

This commit is contained in:
Igor Kulikov 2020-03-25 11:11:10 +02:00
parent a1347eb03e
commit 8e61d9c829

View File

@ -170,8 +170,8 @@ export default abstract class LeafletMap {
this.map.setZoom(this.options.defaultZoomLevel, { animate: false }); this.map.setZoom(this.options.defaultZoomLevel, { animate: false });
this.map.panTo(bounds.getCenter(), { animate: false }); this.map.panTo(bounds.getCenter(), { animate: false });
} else { } else {
this.map.once('zoomend', function () { this.map.once('zoomend', () => {
if (!this.options.defaultZoomLevel && this.options.map.getZoom() > this.options.minZoomLevel) { if (!this.options.defaultZoomLevel && this.map.getZoom() > this.options.minZoomLevel) {
this.map.setZoom(this.options.minZoomLevel, { animate: false }); this.map.setZoom(this.options.minZoomLevel, { animate: false });
} }
}); });
@ -323,4 +323,4 @@ export default abstract class LeafletMap {
this.polygons.get(key).updatePolygon(data, dataSources, settings); this.polygons.get(key).updatePolygon(data, dataSources, settings);
}); });
} }
} }