From 3d4524268415c278b7e6c24d309032a84ec6e515 Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Tue, 1 Aug 2023 14:27:23 +0200 Subject: [PATCH] Remove use of getMap on the map itself --- umap/static/umap/js/umap.controls.js | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/umap/static/umap/js/umap.controls.js b/umap/static/umap/js/umap.controls.js index da996445..cc702182 100644 --- a/umap/static/umap/js/umap.controls.js +++ b/umap/static/umap/js/umap.controls.js @@ -813,14 +813,14 @@ L.U.Map.include({ const advancedFiltersFull = {} let filtersAlreadyLoaded = true - if (!this.getMap().options.advancedFilters) { - this.getMap().options.advancedFilters = {} + if (!this.options.advancedFilters) { + this.options.advancedFilters = {} filtersAlreadyLoaded = false } advancedFilterKeys.forEach((property) => { advancedFiltersFull[property] = [] - if (!filtersAlreadyLoaded || !this.getMap().options.advancedFilters[property]) { - this.getMap().options.advancedFilters[property] = [] + if (!filtersAlreadyLoaded || !this.options.advancedFilters[property]) { + this.options.advancedFilters[property] = [] } }) this.eachBrowsableDataLayer((datalayer) => { @@ -842,10 +842,10 @@ L.U.Map.include({ filter_check.type = 'checkbox' filter_check.id = `checkbox_${property}_${value}` filter_check.checked = - this.getMap().options.advancedFilters[property] && - this.getMap().options.advancedFilters[property].includes(value) - filter_check.setAttribute('data-property', property) - filter_check.setAttribute('data-value', value) + this.options.advancedFilters[property] && + this.options.advancedFilters[property].includes(value) + filter_check.dataset.property = property + filter_check.dataset.value = value filter_label.htmlFor = `checkbox_${property}_${value}` filter_label.innerHTML = value L.DomEvent.on( @@ -855,10 +855,10 @@ L.U.Map.include({ const property = e.srcElement.dataset.property const value = e.srcElement.dataset.value if (e.srcElement.checked) { - this.getMap().options.advancedFilters[property].push(value) + this.options.advancedFilters[property].push(value) } else { - this.getMap().options.advancedFilters[property].splice( - this.getMap().options.advancedFilters[property].indexOf(value), + this.options.advancedFilters[property].splice( + this.options.advancedFilters[property].indexOf(value), 1 ) }