No inertia if drag is stopped before ending the drag (#5690)
Fixes #5652.
This commit is contained in:
parent
411ffcced9
commit
b7cbcb39b8
@ -129,10 +129,7 @@ export var Drag = Handler.extend({
|
||||
this._positions.push(pos);
|
||||
this._times.push(time);
|
||||
|
||||
if (time - this._times[0] > 50) {
|
||||
this._positions.shift();
|
||||
this._times.shift();
|
||||
}
|
||||
this._prunePositions(time);
|
||||
}
|
||||
|
||||
this._map
|
||||
@ -140,6 +137,13 @@ export var Drag = Handler.extend({
|
||||
.fire('drag', e);
|
||||
},
|
||||
|
||||
_prunePositions: function (time) {
|
||||
while (this._positions.length > 1 && time - this._times[0] > 50) {
|
||||
this._positions.shift();
|
||||
this._times.shift();
|
||||
}
|
||||
},
|
||||
|
||||
_onZoomEnd: function () {
|
||||
var pxCenter = this._map.getSize().divideBy(2),
|
||||
pxWorldCenter = this._map.latLngToLayerPoint([0, 0]);
|
||||
@ -192,6 +196,7 @@ export var Drag = Handler.extend({
|
||||
map.fire('moveend');
|
||||
|
||||
} else {
|
||||
this._prunePositions(+new Date());
|
||||
|
||||
var direction = this._lastPos.subtract(this._positions[0]),
|
||||
duration = (this._lastTime - this._times[0]) / 1000,
|
||||
|
Loading…
Reference in New Issue
Block a user