mirror of
https://github.com/sstent/aicyclingcoach-go.git
synced 2026-01-27 09:32:08 +00:00
sync
This commit is contained in:
28
node_modules/@react-leaflet/core/lib/path.js
generated
vendored
28
node_modules/@react-leaflet/core/lib/path.js
generated
vendored
@@ -1,28 +0,0 @@
|
||||
import { useEffect, useRef } from 'react';
|
||||
import { useLeafletContext } from './context.js';
|
||||
import { useEventHandlers } from './events.js';
|
||||
import { useLayerLifecycle } from './layer.js';
|
||||
import { withPane } from './pane.js';
|
||||
export function usePathOptions(element, props) {
|
||||
const optionsRef = useRef();
|
||||
useEffect(function updatePathOptions() {
|
||||
if (props.pathOptions !== optionsRef.current) {
|
||||
const options = props.pathOptions ?? {};
|
||||
element.instance.setStyle(options);
|
||||
optionsRef.current = options;
|
||||
}
|
||||
}, [
|
||||
element,
|
||||
props
|
||||
]);
|
||||
}
|
||||
export function createPathHook(useElement) {
|
||||
return function usePath(props) {
|
||||
const context = useLeafletContext();
|
||||
const elementRef = useElement(withPane(props, context), context);
|
||||
useEventHandlers(elementRef.current, props.eventHandlers);
|
||||
useLayerLifecycle(elementRef.current, context);
|
||||
usePathOptions(elementRef.current, props);
|
||||
return elementRef;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user