Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync continuously-updating interaction handlers with render loop #6005

Merged
merged 3 commits into from
Jan 19, 2018

Commits on Jan 19, 2018

  1. Remove two unnecessary _rerender calls

    * Since we `_update` on move, and that already triggers a `_rerender()`, we don't also need to set a separate 'move' listener that calls `_rerender()`
    * Since `_updateEasing()` triggers a `move` event, which in turn schedules a subsequent frame, we don't _also_ need to check `isEasing()` at the end of `render`.
    Anand Thakker committed Jan 19, 2018
    Configuration menu
    Copy the full SHA
    1549102 View commit details
    Browse the repository at this point in the history
  2. Introduce Camera#_startAnimation()

    This refactors `Camera#ease()`, which assumed an animation with a
    fixed end time, in terms of `Camera#_startAnimation()` (and
    `Camera#stop()`), which doesn't. The advantage of this slight
    generalization is that `_startAnimation()` can then also be used by
    continuously-updating interaction handlers (`DragPan`, etc.)
    Anand Thakker committed Jan 19, 2018
    Configuration menu
    Copy the full SHA
    ba7be35 View commit details
    Browse the repository at this point in the history
  3. Refactor Drag{Pan,Rotate}Handler to use camera animation

    Instead of updating the transform directly within the mousemove handler,
    we cede control to the render loop by doing our transform updates in the
    callback we pass to `Camera#_startAnimation`.  This way, we synchronously
    update the transform, render the map, and fire the `move` event (and
    thus trigger any listeners that might perform DOM updates).
    Anand Thakker committed Jan 19, 2018
    Configuration menu
    Copy the full SHA
    0f4441b View commit details
    Browse the repository at this point in the history