chore: change zoomTo signature to make it more explicit
This commit is contained in:
parent
4b05a62b8b
commit
0acf5f2f2f
1 changed files with 4 additions and 5 deletions
|
@ -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())
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue