For Google Maps V3, I have some code that created a marker when a polyline was clicked. I also have some code that creates a marker when the map is clicked.
Earlier today, when I clicked on the polyline, only one marker was created (I’m guessing it didn’t fire a map-click event). Now tonight, I have not changed my code at all, and it is firing both the polyline click event and the map click event and creating two markers. I have no clue if Google changed their maps API between earlier today and now or what, but I need to cancel the click event for the map when the polyline is clicked. Does anyone know how to do this?
EDIT: August 5th Okay what the heck Google! Now it’s back to not firing a map event when the polyline is clicked. Pick a way and stick with it! I am very sure this issue is not related to my code.
You should create a separate click event for your polyline. However, it is hard for the map to determine whether you clicked the map or the polyline. In the case of a polygon, the API should not fire the map event.
If not, you may want to implement some sort of state pattern to block code that shouldn’t execute.