This commit is contained in:
2025-09-11 07:45:47 -07:00
parent 955946e79d
commit a9425720e9
2759 changed files with 0 additions and 294955 deletions

View File

@@ -1,34 +0,0 @@
import { useLeafletContext } from '@react-leaflet/core';
import { useEffect } from 'react';
export function useMap() {
return useLeafletContext().map;
}
export function useMapEvent(type, handler) {
const map = useMap();
useEffect(function addMapEventHandler() {
// @ts-ignore event type
map.on(type, handler);
return function removeMapEventHandler() {
// @ts-ignore event type
map.off(type, handler);
};
}, [
map,
type,
handler
]);
return map;
}
export function useMapEvents(handlers) {
const map = useMap();
useEffect(function addMapEventHandlers() {
map.on(handlers);
return function removeMapEventHandlers() {
map.off(handlers);
};
}, [
map,
handlers
]);
return map;
}