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)