Merge pull request #2100 from umap-project/fix-tilelayer-plus-button

fix: tilelayer plus icon were never displayed
This commit is contained in:
Yohan Boniface 2024-09-04 11:31:28 +02:00 committed by GitHub
commit 185cc65f68
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -795,13 +795,14 @@ U.TileLayerControl = L.Control.IconLayers.extend({
}
})
}
this._allLayers = layers
L.Control.IconLayers.prototype.setLayers.call(this, layers.slice(0, this.maxShown))
if (this.map.selected_tilelayer) this.setActiveLayer(this.map.selected_tilelayer)
},
_createLayerElements: function () {
L.Control.IconLayers.prototype._createLayerElements.call(this)
if (Object.keys(this._layers).length <= this.maxShown) return
if (Object.keys(this._allLayers).length <= this.maxShown) return
const lastRow = this._container.querySelector(
'.leaflet-iconLayers-layersRow:last-child'
)