Ajout du nom générique sur les lieux

This commit is contained in:
EpicKiwi 2026-06-28 18:17:35 +02:00
parent 42e6d47fe4
commit bb779faa49
Signed by: epickiwi
GPG key ID: C4B28FD2729941CE
2 changed files with 26 additions and 4 deletions

View file

@ -5,6 +5,7 @@ const TEMPLATE = document.createElement("template")
TEMPLATE.innerHTML = `
<camp-feature-legend class="feature-legend"></camp-feature-legend>
<h2 class="feature-name"></h2>
<small class="feature-generic-name"></small>
<camp-coords class="feature-location" lat="0" lon="0"></camp-coords>
`
@ -37,10 +38,18 @@ export class FeatureShortHeaderElement extends HTMLElement {
this.querySelector(".feature-legend").feature = this.feature
this.querySelector(".feature-legend").updateContent()
this.querySelector(".feature-name").textContent =
this.feature?.properties?.name ||
let name = this.feature?.properties?.name ||
this.feature.mapSymbol.genericName ||
this.feature.id
this.feature.id;
this.querySelector(".feature-name").textContent = name;
if(name != this.feature.mapSymbol.genericName){
this.querySelector(".feature-generic-name").textContent = this.feature.mapSymbol.genericName
} else {
this.querySelector(".feature-generic-name").replaceChildren()
}
let featurePoint = this.feature.asPoint()