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
|
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())
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue