Loading src/components/LMap.vue +2 −7 Original line number Diff line number Diff line Loading @@ -11,8 +11,8 @@ import { propsBinder, debounce, resetWebpackIcon, updateLeafletMethod, provideLeafletPlaceholders, updateLeafletMethods, } from "../utils.js"; export default { Loading Loading @@ -327,12 +327,7 @@ export default { }, }; updateLeafletMethod(schematics.addLayer, methods.addLayer); updateLeafletMethod(schematics.removeLayer, methods.removeLayer); updateLeafletMethod( schematics.registerLayerControl, methods.registerLayerControl ); updateLeafletMethods(schematics, methods); blueprint.leafletRef = map(root.value, options); Loading src/components/LMarker.vue +2 −2 Original line number Diff line number Diff line Loading @@ -6,7 +6,7 @@ import { debounce, provideLeafletPlaceholders, injectLeafletMethod, updateLeafletMethod, updateLeafletMethods, } from "../utils.js"; import { props, setup as markerSetup } from "../functions/marker"; Loading Loading @@ -34,7 +34,7 @@ export default { const { marker, DomEvent, latLng, setOptions } = await import( "leaflet/dist/leaflet-src.esm" ); updateLeafletMethod(schematics.latLng, latLng); updateLeafletMethods(schematics, { latLng }); leafletRef.value = marker(props.latLng, options); Loading src/functions/layer.js +2 −3 Original line number Diff line number Diff line Loading @@ -2,7 +2,7 @@ import { onUnmounted } from "vue"; import { provideLeafletPlaceholders, injectLeafletMethod, updateLeafletMethod, updateLeafletMethods, } from "../utils"; export const props = { Loading Loading @@ -94,8 +94,7 @@ export const setup = (props, leafletRef, context) => { "bindTooltip", "unbindTooltip", ]); updateLeafletMethod(schematics.bindTooltip, methods.bindTooltip); updateLeafletMethod(schematics.unbindTooltip, methods.unbindTooltip); updateLeafletMethods(schematics, methods); onUnmounted(() => { methods.unbindPopup(); Loading src/utils.js +17 −2 Original line number Diff line number Diff line Loading @@ -89,8 +89,23 @@ export const provideLeafletMethods = (methods) => { } }; export const updateLeafletMethod = (methodRef, updateMethod) => { methodRef.value = updateMethod; /** * Update any or all of the leaflet method references originally created * by provideLeafletMethods. * * Each key that exists in the updateMethods object will replace the Leaflet * method with the same name in methodRefs, if it exists. Methods that are * not already part of methodRefs will not be added. * * @param {*} methodRefs * @param {*} updateMethods */ export const updateLeafletMethods = (methodRefs, updateMethods) => { for (const methodName in updateMethods) { if (methodRefs[methodName]) { methodRefs[methodName].value = updateMethods[methodName]; } } }; export const injectLeafletMethod = (methodName) => { Loading Loading
src/components/LMap.vue +2 −7 Original line number Diff line number Diff line Loading @@ -11,8 +11,8 @@ import { propsBinder, debounce, resetWebpackIcon, updateLeafletMethod, provideLeafletPlaceholders, updateLeafletMethods, } from "../utils.js"; export default { Loading Loading @@ -327,12 +327,7 @@ export default { }, }; updateLeafletMethod(schematics.addLayer, methods.addLayer); updateLeafletMethod(schematics.removeLayer, methods.removeLayer); updateLeafletMethod( schematics.registerLayerControl, methods.registerLayerControl ); updateLeafletMethods(schematics, methods); blueprint.leafletRef = map(root.value, options); Loading
src/components/LMarker.vue +2 −2 Original line number Diff line number Diff line Loading @@ -6,7 +6,7 @@ import { debounce, provideLeafletPlaceholders, injectLeafletMethod, updateLeafletMethod, updateLeafletMethods, } from "../utils.js"; import { props, setup as markerSetup } from "../functions/marker"; Loading Loading @@ -34,7 +34,7 @@ export default { const { marker, DomEvent, latLng, setOptions } = await import( "leaflet/dist/leaflet-src.esm" ); updateLeafletMethod(schematics.latLng, latLng); updateLeafletMethods(schematics, { latLng }); leafletRef.value = marker(props.latLng, options); Loading
src/functions/layer.js +2 −3 Original line number Diff line number Diff line Loading @@ -2,7 +2,7 @@ import { onUnmounted } from "vue"; import { provideLeafletPlaceholders, injectLeafletMethod, updateLeafletMethod, updateLeafletMethods, } from "../utils"; export const props = { Loading Loading @@ -94,8 +94,7 @@ export const setup = (props, leafletRef, context) => { "bindTooltip", "unbindTooltip", ]); updateLeafletMethod(schematics.bindTooltip, methods.bindTooltip); updateLeafletMethod(schematics.unbindTooltip, methods.unbindTooltip); updateLeafletMethods(schematics, methods); onUnmounted(() => { methods.unbindPopup(); Loading
src/utils.js +17 −2 Original line number Diff line number Diff line Loading @@ -89,8 +89,23 @@ export const provideLeafletMethods = (methods) => { } }; export const updateLeafletMethod = (methodRef, updateMethod) => { methodRef.value = updateMethod; /** * Update any or all of the leaflet method references originally created * by provideLeafletMethods. * * Each key that exists in the updateMethods object will replace the Leaflet * method with the same name in methodRefs, if it exists. Methods that are * not already part of methodRefs will not be added. * * @param {*} methodRefs * @param {*} updateMethods */ export const updateLeafletMethods = (methodRefs, updateMethods) => { for (const methodName in updateMethods) { if (methodRefs[methodName]) { methodRefs[methodName].value = updateMethods[methodName]; } } }; export const injectLeafletMethod = (methodName) => { Loading