I'm trying to move a marker and drop marker only when under marker exists previously layer aded.
The problem is that sometimes it does not detect the layer below or when I change the zoom, the positions do not correspond between them.
I have tried using turf functions to detect if the marker is inside the line or touches the line but it doesn't work.
It is as if when zooming the layer is displayed well but changes the position of the lines, because I pass the mark where the line is drawn and does not return anything but I move it to other areas where there is nothing drawn and if it returns that the layer is underneath.
I'm trying to move a marker and drop marker only when under marker exists previously layer aded.
The problem is that sometimes it does not detect the layer below or when I change the zoom, the positions do not correspond between them.
I have tried using turf functions to detect if the marker is inside the line or touches the line but it doesn't work.
It is as if when zooming the layer is displayed well but changes the position of the lines, because I pass the mark where the line is drawn and does not return anything but I move it to other areas where there is nothing drawn and if it returns that the layer is underneath.
What am doing wrong?? How can I solve it??
Here is an example: https://codesandbox.io/s/infallible-wood-d49yk?file=/src/Map.js