Merge pull request #1432 from umap-project/locate-easing

Set map default center even if waiting for user location
This commit is contained in:
Yohan Boniface 2023-11-26 21:58:36 +01:00 committed by GitHub
commit 84d7c8771e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -688,7 +688,11 @@ L.U.Map.include({
// FIXME An invalid hash will cause the load to fail
this._hash.update()
} else if (this.options.defaultView === 'locate' && !this.options.noControl) {
this.once('locationerror', this._setDefaultCenter)
// When using locate as default map view AND activating easing
// Leaflet.locate will ask the map view to compute transition to user
// position, so in this case we do need a default center, so let's
// set it anyway
this._setDefaultCenter()
this._controls.locate.start()
} else if (this.options.defaultView === 'data') {
this.onceDataLoaded(() => {