Skip to content

Commit

Permalink
Adds tap-to-click in viewport drag mode
Browse files Browse the repository at this point in the history
  • Loading branch information
jp-bennett committed Apr 13, 2016
1 parent c829476 commit b467c2d
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions include/rfb.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ var RFB;
this._mouse_arr = [];
this._viewportDragging = false;
this._viewportDragPos = {};
this._viewportHasMoved = false;

// set the default value on user-facing properties
Util.set_defaults(this, defaults, {
Expand Down Expand Up @@ -593,6 +594,13 @@ var RFB;
return;
} else {
this._viewportDragging = false;

// If the viewport didn't actually move, then treat as a mouse click event
// Send the button down event here, as the button up event is sent at the end of this function
if (!this._viewportHasMoved) {
RFB.messages.pointerEvent(this._sock, this._display.absX(x), this._display.absY(y), bmask);
}
this._viewportHasMoved = false;
}
}

Expand All @@ -608,6 +616,11 @@ var RFB;
var deltaY = this._viewportDragPos.y - y;
this._viewportDragPos = {'x': x, 'y': y};

// if there is actually viewport move, set the HasMoved flag to true
if (deltaX != 0 || deltaY != 0) {
this._viewportHasMoved = true;
}

this._display.viewportChangePos(deltaX, deltaY);

// Skip sending mouse events
Expand Down

0 comments on commit b467c2d

Please sign in to comment.