From 1f61378aac3e36585183ab5a91b99334093e63f6 Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Thu, 12 Oct 2023 10:57:05 +0200 Subject: [PATCH] Fix map reference in DataLayersControl This would create an error when DataLayersControl is not added to the map, but the mouseenter/leave event would still be active through the datalayers list --- umap/static/umap/js/umap.controls.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/umap/static/umap/js/umap.controls.js b/umap/static/umap/js/umap.controls.js index 62e0d83a..24cd8de3 100644 --- a/umap/static/umap/js/umap.controls.js +++ b/umap/static/umap/js/umap.controls.js @@ -514,7 +514,7 @@ L.U.DataLayersControl = L.Control.extend({ update: function () { if (this._datalayers_container && this._map) { this._datalayers_container.innerHTML = '' - this._map.eachDataLayerReverse(function (datalayer) { + this.map.eachDataLayerReverse(function (datalayer) { this.addDataLayer(this._datalayers_container, datalayer) }, this) } @@ -525,7 +525,7 @@ L.U.DataLayersControl = L.Control.extend({ }, collapse: function () { - if (this._map.options.datalayersControl === 'expanded') return + if (this.map.options.datalayersControl === 'expanded') return L.DomUtil.removeClass(this._container, 'expanded') },