Commit 5081f647 authored by Michael Underwood's avatar Michael Underwood
Browse files

Provide methods needed by LIcon

parent ced8d933
Loading
Loading
Loading
Loading
+10 −5
Original line number Diff line number Diff line
<script>
import { onMounted, ref, h, inject } from "vue";
import { onMounted, ref, h, provide, inject } from "vue";
import {
  remapEvents,
  propsBinder,
@@ -22,6 +22,15 @@ export default {
    const addLayer = inject("addLayer");

    const latLng = provideLeafletWrapper("latLng");
    provide("canSetParentHtml", () => !!leafletRef.value.getElement());
    provide(
      "setParentHtml",
      (html) => (leafletRef.value.getElement().innerHTML = html)
    );
    provide(
      "setIcon",
      (newIcon) => leafletRef.value.setIcon && leafletRef.value.setIcon(newIcon)
    );
    const { options, methods } = markerSetup(props, leafletRef, context);

    onMounted(async () => {
@@ -35,10 +44,6 @@ export default {

      leafletRef.value = marker(props.latLng, options);

      schematics.canSetParentHtml = () => !!leafletRef.value.getElement();
      schematics.setParentHtml = (html) =>
        (leafletRef.value.getElement().innerHTML = html);

      const listeners = remapEvents(context.attrs);
      DomEvent.on(leafletRef.value, listeners);