Merge pull request #8246 from ahocevar/movetolerance-dragging
Don't go back to not moving when dragging
This commit is contained in:
@@ -301,7 +301,8 @@ MapBrowserEventHandler.prototype.relayEvent_ = function(pointerEvent) {
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
MapBrowserEventHandler.prototype.isMoving_ = function(pointerEvent) {
|
MapBrowserEventHandler.prototype.isMoving_ = function(pointerEvent) {
|
||||||
return Math.abs(pointerEvent.clientX - this.down_.clientX) > this.moveTolerance_ ||
|
return this.dragging_ ||
|
||||||
|
Math.abs(pointerEvent.clientX - this.down_.clientX) > this.moveTolerance_ ||
|
||||||
Math.abs(pointerEvent.clientY - this.down_.clientY) > this.moveTolerance_;
|
Math.abs(pointerEvent.clientY - this.down_.clientY) > this.moveTolerance_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -168,5 +168,20 @@ describe('ol.MapBrowserEventHandler', function() {
|
|||||||
});
|
});
|
||||||
expect(moveToleranceHandler.isMoving_(pointerdownAt9)).to.be(true);
|
expect(moveToleranceHandler.isMoving_(pointerdownAt9)).to.be(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('is moving when moving back close to the down pixel', function() {
|
||||||
|
const pointermoveAt9 = new PointerEvent('pointermove', {}, {
|
||||||
|
clientX: (DEVICE_PIXEL_RATIO * 8) + 1,
|
||||||
|
clientY: (DEVICE_PIXEL_RATIO * 8) + 1
|
||||||
|
});
|
||||||
|
moveToleranceHandler.handlePointerMove_(pointermoveAt9);
|
||||||
|
expect(moveToleranceHandler.isMoving_(pointermoveAt9)).to.be(true);
|
||||||
|
const pointermoveAt2 = new PointerEvent('pointermove', {}, {
|
||||||
|
clientX: DEVICE_PIXEL_RATIO + 1,
|
||||||
|
clientY: DEVICE_PIXEL_RATIO + 1
|
||||||
|
});
|
||||||
|
moveToleranceHandler.handlePointerMove_(pointermoveAt2);
|
||||||
|
expect(moveToleranceHandler.isMoving_(pointermoveAt2)).to.be(true);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user