I have a Google Map API v3 map on a page that uses MarkerClusterer . I have a function that needs to be run when we click on the map, it is registered as:
google.maps.event.addListener(map, 'click', function (event) { CallMe(event.latLng); });
So my problem is this: when I click on the MarkerClusterer cluster, instead of behaving like a marker and not raising a click event on the map, itโs only the one from the marker that causes a click from the map.
To test this, I created a warning from clicking markerclusterer:
google.maps.event.addListener(markerClusterer, "clusterclick", function (cluster) { alert('MarkerClusterer click event'); });
Thus, clusterclick rises after the click event of a map object. Then I cannot remove the listener of the map object as a solution. Is there a way to check if there is a cluster click in the click event on the map? Or a way to replicate marker behavior and not trigger a map click event when clustererclick is called? Google and the documentation didn't help me.
thanks
source share