You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
410 B
TypeScript
16 lines
410 B
TypeScript
export default class LeafletLine extends HTMLElement {
|
|
static get observedAttributes() {
|
|
return ['lat', 'lng'];
|
|
}
|
|
|
|
get latlng(): [number, number] {
|
|
return [+(this.getAttribute('lat') ?? 0), +(this.getAttribute('lng') ?? 0)];
|
|
}
|
|
|
|
attributeChangedCallback() {
|
|
this.dispatchEvent(new CustomEvent('line-updated', { bubbles: true }));
|
|
}
|
|
}
|
|
|
|
customElements.define('leaflet-line', LeafletLine);
|