Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Map event bounds_changed triggered multiple times when dragging

I have a google map with markers. I want my markers to be refreshed when the map is moved/zoomed...

Google recommend to use the event bounds_changed for that, but when I move the map, the event is triggered for each pixel that I move the map. I want the map to be refreshed only when the user stopped moving the map, i.e. when he released the mouse button after dragging.

How can I do that ?

like image 764
Matthieu Napoli Avatar asked Dec 02 '10 18:12

Matthieu Napoli


People also ask

Which event is triggered when the map is continuously moved and dragged?

bounds_changed event fires repeatedly when the map is panning or dragging; I'd expect it to fire only when the move has finished.

How do I add an event to Google Maps?

To add an event, head to Google Maps on Android, tap on Contribute >Events > Add a public event. You can add an event name, tag the location, and add the time and date of the event as well. There's an option to add an image, write more event details, and add description as well.


1 Answers

It turns out it was a reported bug: http://code.google.com/p/gmaps-api-issues/issues/detail?id=1371.

The Google team recommend to use the event "idle". For example :

google.maps.event.addListener(map, 'idle', function() { }); 
like image 162
Matthieu Napoli Avatar answered Oct 28 '22 17:10

Matthieu Napoli