From ee7439a0f9943cd015a1ee88ee80cc22e2d025cf Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Wed, 4 Sep 2024 11:23:20 +0200 Subject: [PATCH] fix: tilelayer plus icon where never displayed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We were testing the length of the `_layers` property, which where sliced to `maxShown` before… --- umap/static/umap/js/umap.controls.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/umap/static/umap/js/umap.controls.js b/umap/static/umap/js/umap.controls.js index 33d0c282..8fc6a5df 100644 --- a/umap/static/umap/js/umap.controls.js +++ b/umap/static/umap/js/umap.controls.js @@ -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' )