Reputation: 1725
When using MarkerClustererPlus - I would like to hang some code on an event that is triggered when a marker that is in a cluster is shown / hidden by the markerClusterer.
MC+ Doco doesn't seem to indicate such an event.
Looking at the MC+ code it appears that the clusterer uses marker.setMap() and markers don't have a "map_changed" event.
I could add code to the clusterer to trigger an event whenever a marker.setMap is invoked but I'd rather not alter code that works so well - don't want to create a configuration management problem whenever markerClustererPlus is updated.
Any suggestions?
Upvotes: 1
Views: 631
Reputation: 1725
Shortly after posting the question, I discovered that I could hang an event on marker, 'map_changed'.
google.maps.event.addListener(myMarker, 'map_changed',
function() { do stuff });
I think this is an MVC state change event rather than an explicit marker event (i.e. it isn't defined as a marker event in the documentation). (see Google event doco here) and Google marker event doco here
The only remaining question is - it would be nice to verify that this is an MVC state change event rather than an undocumented / unsupported marker event that could break or disappear - How can I do that?
Upvotes: 5