From 5832b567876a25e778c02647b372941c4c42f9c6 Mon Sep 17 00:00:00 2001 From: EpicKiwi Date: Sun, 28 Jun 2026 17:02:31 +0200 Subject: [PATCH] =?UTF-8?q?Les=20plygones=20peuvent=20maintenant=20=C3=AAt?= =?UTF-8?q?re=20cliqu=C3=A9s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/map.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/js/map.js b/js/map.js index 9e26f54..8322357 100644 --- a/js/map.js +++ b/js/map.js @@ -152,6 +152,21 @@ export async function init_places(places_db){ } }, onEachFeature: function(feature, layer){ + let href + + if(feature.id){ + href = `#${encodeURIComponent(feature.id)}` + } else if(feature.parentFeature?.id){ + href = `#${encodeURIComponent(feature.parentFeature.id)}` + } + + layer.on("click", e => { + if(location.hash != href){ + location.hash = href + } + console.log("clicked layer", feature) + }) + feature[HIGHLIGHT_LAYER] = layer } }).addTo(map)