Merge pull request #3038 from flemenach/worldcopy-inertia

Fix inertia animation with worldCopyJump enabled
This commit is contained in:
Vladimir Agafonkin 2014-11-18 16:47:41 +02:00
commit 2bd788a7da

View File

@ -67,7 +67,7 @@ L.Map.Drag = L.Handler.extend({
_onDrag: function () {
if (this._map.options.inertia) {
var time = this._lastTime = +new Date(),
pos = this._lastPos = this._draggable._newPos;
pos = this._lastPos = this._draggable._absPos || this._draggable._newPos;
this._positions.push(pos);
this._times.push(time);
@ -101,6 +101,7 @@ L.Map.Drag = L.Handler.extend({
newX2 = (x + halfWidth + dx) % worldWidth - halfWidth - dx,
newX = Math.abs(newX1 + dx) < Math.abs(newX2 + dx) ? newX1 : newX2;
this._draggable._absPos = this._draggable._newPos.clone();
this._draggable._newPos.x = newX;
},