Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pedantically, this wasn't a lag, but rather missed frames.
A variety of actions can trigger rerendering. We want to perform animations before other updates. To ensure that renderings are well ordered and not called too often, we were removing an animation frame request and then creating a new one to ensure that the callback happened at the end of the animation frame cycle. However, sometimes this would defer the animation frame callback until a later cycle rather than just at the end of the next cycle.
By using a single animation queue, we ensure that get all of the callbacks we want in the animation cycle. This has the fringe benefit that it has less overhead in Chrome. Furthermore, by using a shared array for the animation queue, two map instances can be synchronized, whereas, before, there was likely to be a lag between them.
A few other minor optimizations have been made: vgl textures are built in the _build step not in the animation frame. The vgl camera is only updated just as needed, so if two pan events happen in a single frame, only one update will occur.
Resolves issue #526.