Commit c33e004d authored by Michael Underwood's avatar Michael Underwood
Browse files

Make layers unbind their popups, instead of popups unbind from their layers

Fixes #266
parent de323944
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -14,6 +14,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
  additional content within the `<LMarker>` component, _and_ at least some of that content is something
  other than a tooltip or popup, resolving
  [#269 Marker with tooltip no longer visible with v0.8.2](https://github.com/vue-leaflet/vue-leaflet/issues/269).
- Tweaked how popups and tooltips are unbound when they unmount, resolving
  [#266 Vue-leaflet LPopup does not update with prop change](https://github.com/vue-leaflet/vue-leaflet/issues/266).

### Changed

+14 −12
Original line number Diff line number Diff line
@@ -92,21 +92,23 @@ export const setupLayer = (props, leafletRef, context) => {
      leafletRef.value.bindTooltip(leafletObject);
    },
    unbindTooltip() {
      const tooltip =
        leafletRef.value && isFunction(leafletRef.value.getTooltip)
          ? leafletRef.value.getTooltip()
          : null;
      if (tooltip && isFunction(tooltip.unbindTooltip)) {
        tooltip.unbindTooltip();
      if (leafletRef.value) {
        if (isFunction(leafletRef.value.closeTooltip)) {
          leafletRef.value.closeTooltip();
        }
        if (isFunction(leafletRef.value.unbindTooltip)) {
          leafletRef.value.unbindTooltip();
        }
      }
    },
    unbindPopup() {
      const popup =
        leafletRef.value && isFunction(leafletRef.value.getPopup)
          ? leafletRef.value.getPopup()
          : null;
      if (popup && isFunction(popup.unbindPopup)) {
        popup.unbindPopup();
      if (leafletRef.value) {
        if (isFunction(leafletRef.value.closePopup)) {
          leafletRef.value.closePopup();
        }
        if (isFunction(leafletRef.value.unbindPopup)) {
          leafletRef.value.unbindPopup();
        }
      }
    },
    updateVisibleProp(value) {