Google map API v3 event click raise when clickingMarkerClusterer?

Posted by lucian.jp on Stack Overflow See other posts from Stack Overflow or by lucian.jp
Published on 2010-05-21T10:07:09Z Indexed on 2010/05/21 10:10 UTC
Read the original article Hit count: 354

I have a Google Map API v3 map object on a page that uses MarkerClusterer. I have a function that need to run when we click on the map to it is registered as:

google.maps.event.addListener(map, 'click', function (event) {
    CallMe(event.latLng);
});

So my problem is as follows: When I click on a cluster of MarkerClusterer instead of behaving like a marker and not raise the click event on the map but only the one from the marker it calls the click from the map.

To test this I have generated an alert from the markerclusterer click:

google.maps.event.addListener(markerClusterer, "clusterclick", function (cluster) {
    alert('MarkerClusterer click event');
}); 

So the clusterclick rises after the click event of map object. I then can't remove the listener of map object as a solution. Is there any way to test if there was a clusterer click in the click event of the map? Or a way to replicate the marker behaviour and do not raise the click event of map when clustererclick is called? Google and documentation didn’t help me.

Thx

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about javascript-events