mirror of
https://github.com/sstent/aicyclingcoach-go.git
synced 2026-01-27 17:42:23 +00:00
sync
This commit is contained in:
28
node_modules/react-leaflet/lib/Marker.js
generated
vendored
Normal file
28
node_modules/react-leaflet/lib/Marker.js
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
import { createElementObject, createLayerComponent, extendContext } from '@react-leaflet/core';
|
||||
import { Marker as LeafletMarker } from 'leaflet';
|
||||
export const Marker = createLayerComponent(function createMarker({ position , ...options }, ctx) {
|
||||
const marker = new LeafletMarker(position, options);
|
||||
return createElementObject(marker, extendContext(ctx, {
|
||||
overlayContainer: marker
|
||||
}));
|
||||
}, function updateMarker(marker, props, prevProps) {
|
||||
if (props.position !== prevProps.position) {
|
||||
marker.setLatLng(props.position);
|
||||
}
|
||||
if (props.icon != null && props.icon !== prevProps.icon) {
|
||||
marker.setIcon(props.icon);
|
||||
}
|
||||
if (props.zIndexOffset != null && props.zIndexOffset !== prevProps.zIndexOffset) {
|
||||
marker.setZIndexOffset(props.zIndexOffset);
|
||||
}
|
||||
if (props.opacity != null && props.opacity !== prevProps.opacity) {
|
||||
marker.setOpacity(props.opacity);
|
||||
}
|
||||
if (marker.dragging != null && props.draggable !== prevProps.draggable) {
|
||||
if (props.draggable === true) {
|
||||
marker.dragging.enable();
|
||||
} else {
|
||||
marker.dragging.disable();
|
||||
}
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user