Note : PolyLine is a Single line between two marker in my case.
Problem : Simply want to remove a polyLine on MapClick .
As you know there is no way to add a click listener to PolyLine. So i have to use MapClick
but i want to remove a PolyLine(simple line) on click .
There are a number of PolyLines drawn between Marker. and i simply want to remove the PolyLine
on which i clicked.
My ideas.
- There is a way to use a loop and check the nearest Marker and remove the line between them.
- One method we study in Mathematics . Point lie on line. When i click on map it check all adjacent marker and check whether this latLng lie on that PolyLine between two Marker.
Both my ideas have some issues/problems. like .
- in the first one if i clicked on any where it will definetly remove the nearest PolyLine . May be i unintentially clicked anywhere
- And in the second one I must have to click exactly on the line. If
the
point
(my click) don't lie on it . The line will not remove.
Don't know how to solve such an issue. Give me an idea
and also tell me how to implement 2nd method. (Point lie on a line between two markers
.)
Or share some resource.
Thanks in Advance..