Add a threshold for viewport dragging (#600)
This commit is contained in:
parent
27e77d468f
commit
32df3fdbe1
|
@ -614,14 +614,18 @@ var RFB;
|
||||||
if (this._viewportDragging) {
|
if (this._viewportDragging) {
|
||||||
var deltaX = this._viewportDragPos.x - x;
|
var deltaX = this._viewportDragPos.x - x;
|
||||||
var deltaY = this._viewportDragPos.y - y;
|
var deltaY = this._viewportDragPos.y - y;
|
||||||
this._viewportDragPos = {'x': x, 'y': y};
|
|
||||||
|
|
||||||
// if there is actually viewport move, set the HasMoved flag to true
|
// The goal is to trigger on a certain physical width, the
|
||||||
if (deltaX != 0 || deltaY != 0) {
|
// devicePixelRatio brings us a bit closer but is not optimal.
|
||||||
|
var dragThreshold = 10 * window.devicePixelRatio;
|
||||||
|
|
||||||
|
if (this._viewportHasMoved || (Math.abs(deltaX) > dragThreshold ||
|
||||||
|
Math.abs(deltaY) > dragThreshold)) {
|
||||||
this._viewportHasMoved = true;
|
this._viewportHasMoved = true;
|
||||||
}
|
|
||||||
|
|
||||||
|
this._viewportDragPos = {'x': x, 'y': y};
|
||||||
this._display.viewportChangePos(deltaX, deltaY);
|
this._display.viewportChangePos(deltaX, deltaY);
|
||||||
|
}
|
||||||
|
|
||||||
// Skip sending mouse events
|
// Skip sending mouse events
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in New Issue