chore: change zoomTo signature to make it more explicit

This commit is contained in:
Yohan Boniface 2024-04-17 14:55:20 +02:00
parent 4b05a62b8b
commit 0acf5f2f2f

View file

@ -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())
}
},