Fitting Markers with fitBounds(): Markers Sometimes not Redrawn

70 views
Skip to first unread message

Jeff Conrad

unread,
Jun 9, 2014, 11:41:26 PM6/9/14
to google-map...@googlegroups.com
I have an application that uses the fitBounds() method to fit a map to
two markers with a polyline between them. In June 2012, this seemed to
work fine, but I now find that sometimes after calling fitBounds(), one
or both of the markers are not redrawn. This happens especially often
if I have zoomed to precisely locate one marker and the other marker is
not within the bounds before calling bitBounds().

Slightly panning the map by hand causes the markers to be redrawn, as
does adding map.panBy(1,0) after calling fitBounds(). It is not
reasonable to ask a user to do the former, and the latter seems pretty
hacky; is there a better way to do this?

Also: often (but not always) the fitting process begins by going to max
zoom and running a slow animation to reach the final viewport bounds. I
don’t recall this happening in 2012. Is there a way to blank the map
and cause a complete redraw rather than the slow animation?

Jeff Conrad

Reply all
Reply to author
Forward
0 new messages