Having difficulty in selecting the lines on react-leaflet map, so I have followed the below solutions,
const canvasRenderer = L.canvas({
tolerance: 5,
});
<Polyline
pathOptions={{
renderer: canvasRenderer,
color: "Black",
smoothFactor: 1,
opacity: 1,
weight: 3,
}}
positions={[51.505, -0.09],[51.51, -0.1],[51.51, -0.12],}
eventHandlers={{
contextmenu(e) {
//some function goes here.
},
}}
>
The renderer was not working and there was no effect on the polylines. That I have posted here, I think the canvasRenderer wont work for react-leaflet
How to use the Leaflet Almost Over plugin with react-leaflet
.
Many thanks for the help.
renderer={canvasRenderer}
on entireMapContainer
not for the singlePolyline
. Now it is working fine.