From 0acf5f2f2f9de690e167a52eea23d9d4bc56d05c Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Wed, 17 Apr 2024 14:55:20 +0200 Subject: [PATCH] chore: change zoomTo signature to make it more explicit --- umap/static/umap/js/umap.features.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/umap/static/umap/js/umap.features.js b/umap/static/umap/js/umap.features.js index 9252334c..d7d9f4e9 100644 --- a/umap/static/umap/js/umap.features.js +++ b/umap/static/umap/js/umap.features.js @@ -307,14 +307,13 @@ U.FeatureMixin = { return value }, - zoomTo: function (e) { - e = e || {} - const easing = e.easing !== undefined ? e.easing : this.map.getOption('easing') - if (e.callback) this.map.once('moveend', e.callback.call(this)) + zoomTo: function ({ easing, latlng, callback } = {}) { + if (easing === undefined) easing = this.map.getOption('easing') + if (callback) this.map.once('moveend', callback.call(this)) if (easing) { this.map.flyTo(this.getCenter(), this.getBestZoom()) } else { - const latlng = e.latlng || this.getCenter() + latlng = latlng || this.getCenter() this.map.setView(latlng, this.getBestZoom() || this.map.getZoom()) } },