Pan faster than you can say optimizePanAnimation

The 3.7 release of the JavaScript API was a big one, with many great new features. One thing we added was a new map configuration option called optimizePanAnimation. It was a single bullet point in a long list so a follow-up post was in order to explain why we added it and what it does.

Earlier this year, a JavaScript API team member was talking to a developer about panning a map between locations and how it was incredibly slow. As the developer elaborated on their use case, it became clear that there was room for improvement in API. The use case was that map.centerAt() was used to pan the map large distances when the map was at medium to large scales (think zoom level 10 and greater). Calling centerAt() was causing the map to request and load hundreds of tiles to accommodate the default map pan animation. As I’m sure you’ve guessed, loading hundreds of tiles is slow and in turn makes the map look and feel slow. Using map.setExtent() could have the same result if the new extent does not cause a zoom level change.

To address this, we decided to add a configuration option to the map. We threw around a few different names, I suggested abuseTiledServices but that seemed a little too opinionated. We settled on optimizePanAnimation and made it true by default. If you’d like to get the pre-3.7 behavior back because you or your users prefer the pan animation as it provides some orientation of where the map is going, use optimizePanAnimation: false when you create a map.

To really drive home the difference this makes, I’ve put together two demo pages: one to show a map with optimizePanAnimation set to true and the same page with optimizePanAnimation set to false. Try both by clicking the city names in the side bar to see the difference in time it takes to move between cities and how many tiles are loaded in each case.

This entry was posted in App Developers, Developer and tagged , . Bookmark the permalink.

Leave a Reply

4 Comments

  1. raymondhuang says:

    Excellent fundamental enhancement!!

  2. wiseguy says:

    Awesome, thanks!

  3. disuse says:

    This is a nice big improvement in terms of client experience and helped take some pressure off of our tiled services that we host.

    Thanks guys!

  4. carlos.guerrero.esri says:

    Fantastic!!
    Thanks!