views:

31

answers:

1

In version 2 of the API the map click event returned an Overlay, LatLng, Overlaylatlng.

I used this to create a generic map event that would either retrieve the coordinates of the Map click event, or return the coordinates of a Marker or other type of Overlay.

Now that API v3 doesn't return the Overlay or Overlaylatlng during the map click event, how can I go about creating a generic "click" event for the map that works if the user clicks on a marker or overlay? I really don't want to create a click event for each marker I have on my page as I am creating anywhere from a handful to a couple thousand markers.

Also, I had to create a custom ImageMapType in order to display the StreetViewOverlay like we could do in v2 of the API because I couldn't find anywhere that told me how to add the StreetViewOverlay without the pegman icon. How can I go about retrieving the LatLng coordinates of a click on this overlay type as well?

A: 

You will need to add a click listener to each overlay you add. You can do this in a createMarker function to reduce your code overhead.

Clicks on markers do not trigger a click event on the map at all.

plexer