Les plygones peuvent maintenant être cliqués
This commit is contained in:
parent
0f0908eddd
commit
5832b56787
1 changed files with 15 additions and 0 deletions
15
js/map.js
15
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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue