Ajout des legendes
This commit is contained in:
parent
af337ea0bf
commit
48aad70993
3 changed files with 98 additions and 1 deletions
|
|
@ -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 ||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue