diff --git a/umap/static/umap/js/modules/data/layer.js b/umap/static/umap/js/modules/data/layer.js index 9edd48a40..a6f77a671 100644 --- a/umap/static/umap/js/modules/data/layer.js +++ b/umap/static/umap/js/modules/data/layer.js @@ -950,9 +950,13 @@ export class DataLayer extends ServerStored { else this.hide() } - zoomTo(bounds) { + zoomTo() { if (!this.isVisible()) return - bounds = bounds || this.layer.getBounds() + const bounds = this.layer.getBounds() + this.zoomToBounds(bounds) + } + + zoomToBounds(bounds) { if (bounds.isValid()) { const options = { maxZoom: this.getOption('zoomTo') } this._leafletMap.fitBounds(bounds, options) diff --git a/umap/static/umap/js/modules/importer.js b/umap/static/umap/js/modules/importer.js index 1da6d566b..9d1d6180f 100644 --- a/umap/static/umap/js/modules/importer.js +++ b/umap/static/umap/js/modules/importer.js @@ -382,7 +382,7 @@ export default class Importer extends Utils.WithTemplate { bounds.extend(featureBounds) } this.onSuccess(features.length) - layer.zoomTo(bounds) + layer.zoomToBounds(bounds) } } }