Question

I have a web page with a google map (api v3) that has dozens of markers. I'm using markerclusterer to cluster the markers. And I have a separate panel div listing title info for each of the marker that appear on the map.

I've set up a hover event so that when the user hovers over one of the titles in the panel the corresponding marker on the map starts to bounce. This works fine if the marker hasn't been incorporated into an existing cluster. However, if the marker been incorporated into a cluster then it does not work because there is no marker to animate.

Is it possible to remove the marker from the cluster without removing it completely from the map, then animate the marker, then add the marker back to the cluster? (I took a look at the source code , but I couldn't figure out how to remove the marker from the cluster while still leaving it on the map.) Of course, if there is an easier way to tackle this problem I would love to hear about it.

Was it helpful?

Solution

After another day and another review of the source I figured out how to solve the problem, and it turns out that the answer is easy.

All you need to do is call marker.setMap(google.maps.Map object). Then, if you want to get fancy, you can call setSums on the ClusterIcon object to reduce the number of markers listed in the cluster overlay by one.

OTHER TIPS

I figured out how to solve the problem. #chuck w solution helped me.

call marker.setMap(map)

Then, if you want to get fancy, you can call

markerCluster.repaint(); to collapse to cluster

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top