Ajout des features de la carte vide

This commit is contained in:
EpicKiwi 2026-06-14 12:21:50 +02:00
parent 9fbf6daafb
commit 03f5bf0215
Signed by: epickiwi
GPG key ID: C4B28FD2729941CE
2 changed files with 33 additions and 6 deletions

View file

@ -32,8 +32,13 @@ window.addEventListener("hashchange", () => {
if (feature) {
MAP.highlight(place_id)
if(document.getElementById("search-result")) {
// If we have a search in progress, opening search item
openSearchResultItem(feature)
} else {
let foundIndex = null;
let panelChildren = document.getElementById("result-panel").children
for(let i = 0; i<panelChildren.length; i++) {
@ -45,25 +50,35 @@ window.addEventListener("hashchange", () => {
}
if(foundIndex != null){
// If a panel with this feature was already added to dom, scrolling to this item
document.getElementById("result-panel").setActiveChildrenIndex(foundIndex, {behavior: "instant"})
} else {
// If nothing was selected and there is no search result, opening feature only
openFeature(feature)
}
}
for(let feature_el of document.getElementById("result-panel").children) {
if(feature_el instanceof FeatureElement){
MAP.show(feature_el.feature)
if(document.getElementById("result-panel").children.length > 1){
for(let feature_el of document.getElementById("result-panel").children) {
if(feature_el instanceof FeatureElement){
MAP.show(feature_el.feature)
}
}
} else {
for(let feature of places.featuresShownOnEmptyMap){
MAP.show(feature)
}
}
}
} else {
MAP.unhighlight_all()
for(let feature of places.featuresShownOnEmptyMap){
MAP.show(feature)
}
}
})
if(location.hash){
window.dispatchEvent(new Event("hashchange"))
}
window.dispatchEvent(new Event("hashchange"))
search_form.addEventListener("submit", e => {
e.preventDefault()