Ajout des legendes

This commit is contained in:
EpicKiwi 2026-06-07 17:45:21 +02:00
parent af337ea0bf
commit 48aad70993
Signed by: epickiwi
GPG key ID: C4B28FD2729941CE
3 changed files with 98 additions and 1 deletions

View file

@ -1,5 +1,8 @@
import "./feature-legend.js"
const TEMPLATE = document.createElement("template")
TEMPLATE.innerHTML = `
<camp-feature-legend class="feature-legend"></camp-feature-legend>
<h2 class="feature-name"></h2>
<small class="feature-location"></small>
`
@ -14,6 +17,9 @@ export class FeatureShortHeaderElement extends HTMLElement {
set feature(value){
this.#feature = value
let legend = this.querySelector(".feature-legend")
if(legend)
legend.feature = value
}
connectedCallback(){
@ -24,7 +30,12 @@ export class FeatureShortHeaderElement extends HTMLElement {
if(!this.feature){
this.replaceChildren()
} else {
this.replaceChildren(TEMPLATE.content.cloneNode(true))
this.querySelector(".feature-legend").feature = this.feature
this.querySelector(".feature-legend").updateContent()
this.querySelector(".feature-name").textContent =
this.feature?.properties?.name ||
this.feature.mapSymbol.genericName ||