Les plygones peuvent maintenant être cliqués

This commit is contained in:
EpicKiwi 2026-06-28 17:02:31 +02:00
parent 0f0908eddd
commit 5832b56787
Signed by: epickiwi
GPG key ID: C4B28FD2729941CE

View file

@ -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)