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.
19 lines
443 B
TypeScript
19 lines
443 B
TypeScript
export class LeafletLine extends HTMLElement {
|
|
static get observedAttributes() {
|
|
return ['lat', 'lng'];
|
|
}
|
|
|
|
get latlng(): [number, number] {
|
|
return [
|
|
parseFloat(this.getAttribute('lat') || '0'),
|
|
parseFloat(this.getAttribute('lng') || '0'),
|
|
];
|
|
}
|
|
|
|
attributeChangedCallback() {
|
|
this.dispatchEvent(new CustomEvent('line-updated', { bubbles: true }));
|
|
}
|
|
}
|
|
|
|
customElements.define('leaflet-line', LeafletLine);
|