Open Ubaid-ur-Rehman opened 1 year ago
@Ubaid-ur-Rehman Thank you for opening this issue. 🙏 Please check out these other resources that might help you get to a resolution in the meantime:
google-maps
tagThis is an automated message, feel free to ignore.
Any update on this issue?
@wangela Still waiting for response.
The Markerclusterer
itself doesn't provide any events for clusters and/or markers except for the clusteringbegin
/ clusteringend
and click
events.
What you can do is provide your own renderer implementation to the Markerclusterer
that will create the cluster markers with the event-handlers set up. Just as a simple example:
import {DefaultRenderer} from '@googlemaps/js-markerclusterer';
class RendererWithEvents extends DefaultRenderer {
render(cluster: Cluster, stats: ClusterStats, map: google.maps.Map): Marker {
const marker = super.render(cluster, stats, map);
// handle events for the newly created marker
marker.addListener('mouseover', () => {
console.log('cluster hovered!', cluster)
});
return marker;
}
}
const clusterer = new MarkerClusterer({
map,
markers,
renderer: new RendererWithEvents()
});
mhmmm this method doesn't work for me, did it work for you? @Ubaid-ur-Rehman do you have a workaround to get the mouse over functionality?
I want to show some data in the info window after creating the clusterer but the event is not being registered.