1
votes

sorry about the vague title, this is the issue: I have a google map with polygons (USA states). The polygons are clickable and link to another page. That all works fine. However, there are also markers on the map that don't have any events attached to them, so clicking on them doesn't do anything.

The problem is, they cover some of the polygons so it's hard to click the polygon because the markers are in front of it so to speak. My question is, is there any way to allow clicking the polygon "through" markers? In other words, I need markers to be visually represented but disregarded when there's any clicking involved.

1

1 Answers

0
votes

I don’t know whether it’s possible with the current Google Maps API, but I guess the solution would involve forwarding of click events:

  1. Capture click event on Marker
  2. Get coordinates of that click event
  3. Check if the coordinates also belong to a polygon, and to which polygon
  4. Trigger a click event on the polygon

The hardest part is probably 3. Again, this is just a guess.