From 17956897b085bee265903087499e5a137460c478 Mon Sep 17 00:00:00 2001 From: Chatewgne Date: Fri, 3 Nov 2023 12:23:48 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20[BUG]=20Fix=20cannot=20click=20o?= =?UTF-8?q?n=20objects=20after=20customizing=20map=20styles=20(refs=20#380?= =?UTF-8?q?0)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/changelog.rst | 1 + geotrek/feedback/static/feedback/main.js | 4 +++- geotrek/infrastructure/static/infrastructure/main.js | 4 +++- geotrek/outdoor/static/outdoor/main.js | 4 +++- geotrek/sensitivity/static/sensitivity/main.js | 4 +++- geotrek/signage/static/signage/main.js | 5 +++-- geotrek/tourism/static/tourism/main.js | 4 +++- 7 files changed, 19 insertions(+), 7 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index 76df434cea..7fde8391b8 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -8,6 +8,7 @@ CHANGELOG **Bug fixes** - Fix: filters choices can raise exception in lists and not updated until application restart (#3812) +- Fix cannot click on objects after customizing map styles (#3800) 2.101.3 (2023-10-26) diff --git a/geotrek/feedback/static/feedback/main.js b/geotrek/feedback/static/feedback/main.js index c489a58e43..5e9bf737e9 100644 --- a/geotrek/feedback/static/feedback/main.js +++ b/geotrek/feedback/static/feedback/main.js @@ -10,9 +10,11 @@ $(window).on('entity:map', function (e, data) { var map = data.map; // Show report layer in application maps + var style = L.Util.extend({ clickable: false }, + window.SETTINGS.map.styles[landLayer.id] || {}); var layer = new L.ObjectsLayer(null, { modelname: modelname, - style: L.Util.extend(window.SETTINGS.map.styles[modelname] || {}, { clickable: false }), + style: style, }); if (data.modelname != modelname) { diff --git a/geotrek/infrastructure/static/infrastructure/main.js b/geotrek/infrastructure/static/infrastructure/main.js index e347e8e289..9f94e35f1b 100644 --- a/geotrek/infrastructure/static/infrastructure/main.js +++ b/geotrek/infrastructure/static/infrastructure/main.js @@ -10,9 +10,11 @@ $(window).on('entity:map', function (e, data) { var map = data.map; // Show infrastructure layer in application maps + var style = L.Util.extend({ clickable: false }, + window.SETTINGS.map.styles[modelname] || {}); var layer = new L.ObjectsLayer(null, { modelname: modelname, - style: L.Util.extend(window.SETTINGS.map.styles[modelname] || {}, { clickable:false }), + style: style, }); if (data.modelname != modelname){ diff --git a/geotrek/outdoor/static/outdoor/main.js b/geotrek/outdoor/static/outdoor/main.js index 6d1a6fde6c..ee548cb1c8 100644 --- a/geotrek/outdoor/static/outdoor/main.js +++ b/geotrek/outdoor/static/outdoor/main.js @@ -4,10 +4,12 @@ $(window).on('entity:map', function (e, data) { var loaded_site = false; var loaded_course = false; // Show outdoor layers in application maps + var style = L.Util.extend({ clickable: false }, + window.SETTINGS.map.styles[modelname] || {}); $.each(['site', 'course'], function (i, modelname) { var layer = new L.ObjectsLayer(null, { modelname: modelname, - style: L.Util.extend(window.SETTINGS.map.styles[modelname] || {}, { clickable: false }), + style: style, }); if (data.modelname != modelname) { map.layerscontrol.addOverlay(layer, tr(modelname), tr('Outdoor')); diff --git a/geotrek/sensitivity/static/sensitivity/main.js b/geotrek/sensitivity/static/sensitivity/main.js index 61f765de6b..4c4de7e333 100644 --- a/geotrek/sensitivity/static/sensitivity/main.js +++ b/geotrek/sensitivity/static/sensitivity/main.js @@ -10,9 +10,11 @@ $(window).on('entity:map', function (e, data) { var map = data.map; // Show sensitiveare layer in application maps + var style = L.Util.extend(window.SETTINGS.map.styles[modelname] || {}, {clickable: false}) + var layer = new L.ObjectsLayer(null, { modelname: modelname, - style: L.Util.extend(window.SETTINGS.map.styles[modelname] || {}, {clickable: false}), + style: style, }); if (data.modelname != modelname) { diff --git a/geotrek/signage/static/signage/main.js b/geotrek/signage/static/signage/main.js index 858c0dce59..30341292e9 100644 --- a/geotrek/signage/static/signage/main.js +++ b/geotrek/signage/static/signage/main.js @@ -8,11 +8,12 @@ $(window).on('entity:map', function (e, data) { var url = window.SETTINGS.urls[layername]; var loaded_infrastructure = false; var map = data.map; - + var style = L.Util.extend({ clickable: false }, + window.SETTINGS.map.styles[modelname] || {}); // Show infrastructure layer in application maps var layer = new L.ObjectsLayer(null, { modelname: modelname, - style: L.Util.extend(window.SETTINGS.map.styles[modelname] || {}, { clickable:false }), + style: style, }); if (data.modelname != modelname){ diff --git a/geotrek/tourism/static/tourism/main.js b/geotrek/tourism/static/tourism/main.js index f53780aa2e..9860af7b10 100644 --- a/geotrek/tourism/static/tourism/main.js +++ b/geotrek/tourism/static/tourism/main.js @@ -56,11 +56,13 @@ $(window).on('entity:map', function (e, data) { var map = data.map; var loaded_event = false; var loaded_touristic = false; + var style = L.Util.extend({ clickable: false }, + window.SETTINGS.map.styles[modelname] || {}); // Show tourism layer in application maps $.each(['touristiccontent', 'touristicevent'], function (i, modelname) { var layer = new L.ObjectsLayer(null, { modelname: modelname, - style: L.Util.extend(window.SETTINGS.map.styles[modelname] || {}, {clickable:false}), + style: style, }); if (data.modelname != modelname){ map.layerscontrol.addOverlay(layer, tr(modelname), tr('Tourism'));