Merge pull request #3038 from flemenach/worldcopy-inertia
Fix inertia animation with worldCopyJump enabled
This commit is contained in:
commit
2bd788a7da
@ -67,7 +67,7 @@ L.Map.Drag = L.Handler.extend({
|
|||||||
_onDrag: function () {
|
_onDrag: function () {
|
||||||
if (this._map.options.inertia) {
|
if (this._map.options.inertia) {
|
||||||
var time = this._lastTime = +new Date(),
|
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._positions.push(pos);
|
||||||
this._times.push(time);
|
this._times.push(time);
|
||||||
@ -101,6 +101,7 @@ L.Map.Drag = L.Handler.extend({
|
|||||||
newX2 = (x + halfWidth + dx) % worldWidth - halfWidth - dx,
|
newX2 = (x + halfWidth + dx) % worldWidth - halfWidth - dx,
|
||||||
newX = Math.abs(newX1 + dx) < Math.abs(newX2 + dx) ? newX1 : newX2;
|
newX = Math.abs(newX1 + dx) < Math.abs(newX2 + dx) ? newX1 : newX2;
|
||||||
|
|
||||||
|
this._draggable._absPos = this._draggable._newPos.clone();
|
||||||
this._draggable._newPos.x = newX;
|
this._draggable._newPos.x = newX;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user