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

@ -297,7 +297,7 @@ body > hr {
camp-feature-short-header {
display: grid;
grid-template-rows: 1fr min-content;
grid-template-columns: 3em 1fr;
grid-template-columns: 3em 1fr max-content;
gap: 0.5ex 0.5em;
vertical-align: center;
}
@ -309,13 +309,26 @@ camp-feature-short-header .feature-legend {
}
camp-feature-short-header h2 {
grid-column: 2 / 4;
margin: 0;
padding: 0;
font-size: 1em;
font-weight: bold;
}
camp-feature-short-header .feature-generic-name {
grid-column: 2;
margin: 0;
padding: 0;
font-size: 0.6em;
opacity: 0.75;
white-space: nowrap;
overflow-x: hidden;
text-overflow: ellipsis;
}
camp-feature-short-header .feature-location {
grid-column: 3;
margin: 0;
padding: 0;
font-size: 0.6em;

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