Skip to content

Commit

Permalink
stop panning/fly animations when necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
mourner committed Oct 21, 2014
1 parent 23998c1 commit d93e828
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 1 addition & 3 deletions src/map/anim/Map.PanAnimation.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ L.Map.include({
center = this._limitCenter(L.latLng(center), zoom, this.options.maxBounds);
options = options || {};

if (this._panAnim) {
this._panAnim.stop();
}
this.stop();

if (this._loaded && !options.reset && options !== true) {

Expand Down
2 changes: 2 additions & 0 deletions src/map/handler/Map.ScrollWheelZoom.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ L.Map.ScrollWheelZoom = L.Handler.extend({
delta = this._delta,
zoom = map.getZoom();

map.stop(); // stop panning and fly animations if any

delta = delta > 0 ? Math.ceil(delta) : Math.floor(delta);
delta = Math.max(Math.min(delta, 4), -4);
delta = map._limitZoom(zoom + delta) - zoom;
Expand Down

0 comments on commit d93e828

Please sign in to comment.