From 7cefd3caf2b01885af02567f6ed1f129cb43f36c 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 | 2 +- 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 | 5 ++++- geotrek/signage/static/signage/main.js | 5 +++-- geotrek/tourism/static/tourism/main.js | 5 ++++- 7 files changed, 21 insertions(+), 8 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index 8f43db808c..d72ac73d1b 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -9,6 +9,7 @@ CHANGELOG - Fix: filters choices can raise exception in lists and not updated until application restart (#3812) - Fix missing geometries for HD `view_points` in APIv2's `/poi/` and `/site/` routes (#3701) +- Fix cannot click on objects after customizing map styles (#3800) 2.101.3 (2023-10-26) @@ -24,7 +25,6 @@ CHANGELOG **Bug fixes** -- Fix UI bug when customizing intervention map style (#3800) - Fix Aggregator fails when updating Tour steps order (#3793) - Fix services list display error (refs ##3795) diff --git a/geotrek/feedback/static/feedback/main.js b/geotrek/feedback/static/feedback/main.js index c489a58e43..101a5a8e8c 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[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/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..2566d7228a 100644 --- a/geotrek/outdoor/static/outdoor/main.js +++ b/geotrek/outdoor/static/outdoor/main.js @@ -5,9 +5,11 @@ $(window).on('entity:map', function (e, data) { var loaded_course = false; // Show outdoor layers in application maps $.each(['site', 'course'], function (i, modelname) { + 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) { 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..364c09a8ce 100644 --- a/geotrek/sensitivity/static/sensitivity/main.js +++ b/geotrek/sensitivity/static/sensitivity/main.js @@ -10,9 +10,12 @@ $(window).on('entity:map', function (e, data) { var map = data.map; // Show sensitiveare 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/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..73f4020252 100644 --- a/geotrek/tourism/static/tourism/main.js +++ b/geotrek/tourism/static/tourism/main.js @@ -56,11 +56,14 @@ $(window).on('entity:map', function (e, data) { var map = data.map; var loaded_event = false; var loaded_touristic = false; + // Show tourism layer in application maps $.each(['touristiccontent', 'touristicevent'], function (i, modelname) { + 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){ map.layerscontrol.addOverlay(layer, tr(modelname), tr('Tourism'));