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 return value
}, },
zoomTo: function (e) { zoomTo: function ({ easing, latlng, callback } = {}) {
e = e || {} if (easing === undefined) easing = this.map.getOption('easing')
const easing = e.easing !== undefined ? e.easing : this.map.getOption('easing') if (callback) this.map.once('moveend', callback.call(this))
if (e.callback) this.map.once('moveend', e.callback.call(this))
if (easing) { if (easing) {
this.map.flyTo(this.getCenter(), this.getBestZoom()) this.map.flyTo(this.getCenter(), this.getBestZoom())
} else { } else {
const latlng = e.latlng || this.getCenter() latlng = latlng || this.getCenter()
this.map.setView(latlng, this.getBestZoom() || this.map.getZoom()) this.map.setView(latlng, this.getBestZoom() || this.map.getZoom())
} }
}, },