Loading src/functions/layer.js +27 −4 Original line number Diff line number Diff line import { onUnmounted, provide, inject, h } from "vue"; import { props as componentProps, setup as componentSetup } from "./component"; import { isFunction } from "../utils"; export const props = { ...componentProps, Loading Loading @@ -74,20 +75,42 @@ export const setup = (props, leafletRef, context) => { } }, bindPopup({ leafletObject }) { if (!leafletRef.value || !isFunction(leafletRef.value.bindPopup)) { console.warn( "Attempt to bind popup before bindPopup method available on layer." ); return; } leafletRef.value.bindPopup(leafletObject); }, bindTooltip({ leafletObject }) { if (!leafletRef.value || !isFunction(leafletRef.value.bindTooltip)) { console.warn( "Attempt to bind tooltip before bindTooltip method available on layer." ); return; } leafletRef.value.bindTooltip(leafletObject); }, unbindTooltip() { const tooltip = leafletRef.value ? leafletRef.value.getTooltip() : null; if (tooltip) { const tooltip = leafletRef.value && isFunction(leafletRef.value.getTooltip) ? leafletRef.value.getTooltip() : null; if (tooltip && isFunction(tooltip.unbindTooltip)) { tooltip.unbindTooltip(); } }, unbindPopup() { const popup = leafletRef.value ? leafletRef.value.getPopup() : null; if (popup) { const popup = leafletRef.value && isFunction(leafletRef.value.getPopup) ? leafletRef.value.getPopup() : null; if (popup && isFunction(popup.unbindPopup)) { popup.unbindPopup(); } }, Loading src/utils.js +2 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,8 @@ export const capitalizeFirstLetter = (string) => { return string.charAt(0).toUpperCase() + string.slice(1); }; export const isFunction = (x) => typeof x === "function"; export const propsBinder = (methods, leafletElement, props) => { for (const key in props) { const setMethodName = "set" + capitalizeFirstLetter(key); Loading Loading
src/functions/layer.js +27 −4 Original line number Diff line number Diff line import { onUnmounted, provide, inject, h } from "vue"; import { props as componentProps, setup as componentSetup } from "./component"; import { isFunction } from "../utils"; export const props = { ...componentProps, Loading Loading @@ -74,20 +75,42 @@ export const setup = (props, leafletRef, context) => { } }, bindPopup({ leafletObject }) { if (!leafletRef.value || !isFunction(leafletRef.value.bindPopup)) { console.warn( "Attempt to bind popup before bindPopup method available on layer." ); return; } leafletRef.value.bindPopup(leafletObject); }, bindTooltip({ leafletObject }) { if (!leafletRef.value || !isFunction(leafletRef.value.bindTooltip)) { console.warn( "Attempt to bind tooltip before bindTooltip method available on layer." ); return; } leafletRef.value.bindTooltip(leafletObject); }, unbindTooltip() { const tooltip = leafletRef.value ? leafletRef.value.getTooltip() : null; if (tooltip) { const tooltip = leafletRef.value && isFunction(leafletRef.value.getTooltip) ? leafletRef.value.getTooltip() : null; if (tooltip && isFunction(tooltip.unbindTooltip)) { tooltip.unbindTooltip(); } }, unbindPopup() { const popup = leafletRef.value ? leafletRef.value.getPopup() : null; if (popup) { const popup = leafletRef.value && isFunction(leafletRef.value.getPopup) ? leafletRef.value.getPopup() : null; if (popup && isFunction(popup.unbindPopup)) { popup.unbindPopup(); } }, Loading
src/utils.js +2 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,8 @@ export const capitalizeFirstLetter = (string) => { return string.charAt(0).toUpperCase() + string.slice(1); }; export const isFunction = (x) => typeof x === "function"; export const propsBinder = (methods, leafletElement, props) => { for (const key in props) { const setMethodName = "set" + capitalizeFirstLetter(key); Loading