Do no try to fit data bounds if bounds are not valid
This may happen if: - the map as some layers containing data, but set as not browsable - any other layer is empty
This commit is contained in:
parent
649f21a0d5
commit
44910f5410
1 changed files with 3 additions and 2 deletions
|
@ -672,11 +672,12 @@ L.U.Map.include({
|
|||
this._controls.locate.start()
|
||||
} else if (this.options.defaultView === 'data') {
|
||||
this.onceDataLoaded(() => {
|
||||
if (!this.hasData()) {
|
||||
const bounds = this.getLayersBounds()
|
||||
if (!this.hasData() || !bounds.isValid()) {
|
||||
this._setDefaultCenter()
|
||||
return
|
||||
}
|
||||
this.fitBounds(this.getLayersBounds())
|
||||
this.fitBounds(bounds)
|
||||
})
|
||||
} else if (this.options.defaultView === 'latest') {
|
||||
this.onceDataLoaded(() => {
|
||||
|
|
Loading…
Reference in a new issue