Is there a callback after map.fitBounds?

google-maps, google-maps-api-3, javascript

Solution

Try this:

 if(!bounds.isEmpty()) {
    map.fitBounds(bounds);
    google.maps.event.addListenerOnce(map, 'idle', function() {
        if (map.getZoom() > 11) {
            map.setZoom(11);
        }  
    });
} 

Problem

My code : ``` if(!bounds.isEmpty()) { map.fitBounds(bounds); if (map.getZoom() > 11) { map.setZoom(11); } } ``` but I see that `map.setZoom(11);` could be called before `.fitBounds` end. So the result is not what I aspect for. Is there a way to manage a callback when `.fitBound` finish?

Original source