On Aug 12, 8:36 am, Nikolai Dimentiev <jorose...@gmail.com> wrote: > I started using version 3, but there is a BIG problem. > > When I create more than 20-30 custom overlays on the map AND try to drag > the map with the mouse there is VERY HUGE lag. > > When I use the build in control to pan the map there is NO lag. > > Any idea what is happening? When I use version 2 the lag appears after > adding more than 200 custom overlays. Version 3 start lagging with 20-30 > only. > > By custom overlay I mean subclassing OverlayView. > > Here are examples: > > google maps v2: 46.233.14.168:8080/GoogleMapsTest/testPage2.jsp > > google maps v3: 46.233.14.168:8080/GoogleMapsTest/testPage.jsp > > the problem appears mainly when using Firefox. Other browsers handle it a > little better but still not smooth as the previous version of google maps > > <http://46.233.14.168:8080/GoogleMapsTest/testPage.jsp>
The API calls your "draw" method automatically. It might be happening too frequently. You could use an "idle" event to update your overlays. You could perform a test in your "draw" method to skip updates if the collection of map tiles has not changed since the last update. Trying to maintain overlay consistency during dragging has no real benefit. Once the map has settled, the overlays ought to be updated. Also, if you can combine your overlays into a single CANVAS element with a single "draw" method, it will be much more efficient than multiple CANVAS elements with multiple "draw" methods. -- 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 google-maps-js-api-v3@googlegroups.com. To unsubscribe from this group, send email to google-maps-js-api-v3+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.