|
|
|
@ -71,8 +71,9 @@ export const MapComponent = ({ markers, onMapClick }: InternalMapProps) => { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
layers.push( |
|
|
|
|
...markers.flatMap((marker, i) => { |
|
|
|
|
...markers.flatMap((marker) => { |
|
|
|
|
const circle = leaflet.circleMarker(marker.coordinates, { |
|
|
|
|
bubblingMouseEvents: false, |
|
|
|
|
color: 'black', |
|
|
|
|
fill: true, |
|
|
|
|
fillOpacity: 100, |
|
|
|
@ -84,11 +85,13 @@ export const MapComponent = ({ markers, onMapClick }: InternalMapProps) => { |
|
|
|
|
permanent: true, |
|
|
|
|
direction: 'center', |
|
|
|
|
className: 'text', |
|
|
|
|
content: `${i + 1}`, |
|
|
|
|
content: `${marker.index}`, |
|
|
|
|
}, |
|
|
|
|
circle, |
|
|
|
|
) |
|
|
|
|
.setLatLng(marker.coordinates); |
|
|
|
|
|
|
|
|
|
circle.on('click', marker.remove); |
|
|
|
|
return [circle, tooltip]; |
|
|
|
|
}), |
|
|
|
|
); |
|
|
|
@ -100,6 +103,7 @@ export const MapComponent = ({ markers, onMapClick }: InternalMapProps) => { |
|
|
|
|
return () => { |
|
|
|
|
for (const layer of layers) { |
|
|
|
|
layer.removeFrom(map); |
|
|
|
|
layer.remove(); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
}, [mapRef, markers]); |
|
|
|
|