You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

14 lines
660 B

2 years ago
import { createElementObject, createLayerComponent, extendContext, updateMediaOverlay } from '@react-leaflet/core';
import { ImageOverlay as LeafletImageOverlay } from 'leaflet';
export const ImageOverlay = createLayerComponent(function createImageOveraly({ bounds , url , ...options }, ctx) {
const overlay = new LeafletImageOverlay(url, bounds, options);
return createElementObject(overlay, extendContext(ctx, {
overlayContainer: overlay
}));
}, function updateImageOverlay(overlay, props, prevProps) {
updateMediaOverlay(overlay, props, prevProps);
if (props.url !== prevProps.url) {
overlay.setUrl(props.url);
}
});