Commit a18c11e6 authored by yuweih's avatar yuweih Committed by Commit bot

[Remoting Android] Fix dragging issue in direct input mode

Currently hold-and-press dragging in direct input mode doesn't quite follow
the user's finger. The problem is that when the viewport moves (since
dragging around), the cursor position will be set to the center of the
screen, while the user's finger may be on somewhere else, causing an offset
between the user's finger and the cursor position. This CL fixes this problem
by always moving the cursor to the finger's position when it's in direct
input mode and the user is dragging around.

BUG=628031

Review-Url: https://codereview.chromium.org/2166423003
Cr-Commit-Position: refs/heads/master@{#407060}
parent 41355a89
......@@ -394,9 +394,9 @@ public class TouchInputHandler {
// If the user is dragging, then the viewport should always follow the user's finger.
PointF newPos = mDesktopCanvas.moveViewportCenter(!followCursor, deltaX, deltaY);
// If we are in an indirect mode or are in the middle of a drag operation, then we want to
// keep the cursor centered, if possible, as the viewport moves.
if (followCursor) {
// If we are in an indirect mode, then we want to keep the cursor centered, if possible, as
// the viewport moves.
if (mInputStrategy.isIndirectInputMode()) {
moveCursor((int) newPos.x, (int) newPos.y);
}
......@@ -503,6 +503,11 @@ public class TouchInputHandler {
}
moveViewportByOffset(delta[0], delta[1]);
if (!mInputStrategy.isIndirectInputMode() && mIsDragging) {
// Ensure the cursor follows the user's finger when the user is dragging under
// direct input mode.
moveCursorToScreenPoint(e2.getX(), e2.getY());
}
return true;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment