I've tried setting a flag variable before the loop that adds markers and then resetting the variable to false afterwards. It's like the zoom_level doesn't actually get changed until a short time after all the markers are placed. I can use setTimout to 100 and then get the proper zoom_level returned after placing the markers but I have a feeling that amount of time will change with a change in number of markers being placed. Can someone shed some light on what I'm doing wrong?
On Jan 12, 6:54 am, Chad Killingsworth <[email protected]> wrote: > I encountered this problem as well. As far as I can tell, you have to > get the proper zoom value inside your zoom_changed event listener. > > I got around that by setting a flag value then adding my markers and > calling fitBounds. Inside my zoom_changed listener, if the flag value > was set, I reset it then called another function to continue > processing. > > Hope that helps, > > Chad Killingsworth > > On Jan 11, 9:52 pm, fly2279 <[email protected]> wrote: > > > > > I am placing markers on the map in a loop and extending the bounds of > > the map to fit the markers. When I use getZoom() to get the zoom level > > after fitting the bounds it's the same as the initial value for the > > map. My initial zoom value is set to 8 and that's what's returned > > after fitting the bounds. I placed a listener on zoom_changed and > > getZoom() returns 10 after fitting the bounds. How do I get the zoom > > level after fitting the bounds since calling getZoom() immediately > > after doesn't seem to return the correct value?
-- You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.
