Skip to content

Commit

Permalink
Merge pull request #1432 from umap-project/locate-easing
Browse files Browse the repository at this point in the history
Set map default center even if waiting for user location
  • Loading branch information
yohanboniface authored Nov 26, 2023
2 parents 1be6b1d + 4347d40 commit 84d7c87
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion umap/static/umap/js/umap.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand Down

0 comments on commit 84d7c87

Please sign in to comment.