diff --git a/src/components/leaflet-marker.ts b/src/components/leaflet-marker.ts index 28ea97e..11edf46 100644 --- a/src/components/leaflet-marker.ts +++ b/src/components/leaflet-marker.ts @@ -52,14 +52,15 @@ export class LeafletMarker extends withProps(HTMLElement, PROPS) { if (!this.#obj || this.#syncing) return; if (name === 'lat' || name === 'lng') { this.#obj.setLatLng([this.#num('lat'), this.#num('lng')]); + } else if (name === 'draggable') { + if (val !== null) this.#obj.dragging?.enable(); + else this.#obj.dragging?.disable(); } else { const propName = PROP_BY_ATTR.get(name); if (!propName) return; const setter = `set${propName.charAt(0).toUpperCase()}${propName.slice(1)}` as keyof Marker; if (typeof this.#obj[setter] === 'function') { - const spec = PROPS[propName as keyof typeof PROPS]; - const value = spec.kind === 'bool-on' ? val !== null : parseAttributeValue(val); - (this.#obj[setter] as (v: unknown) => void)(value); + (this.#obj[setter] as (v: unknown) => void)(parseAttributeValue(val)); } } }