Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1431)

Unified Diff: remoting/android/java/src/org/chromium/chromoting/TrackingInputHandler.java

Issue 50373005: [Android Chromoting] Center the desktop if it is smaller than the screen. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/android/java/src/org/chromium/chromoting/TrackingInputHandler.java
diff --git a/remoting/android/java/src/org/chromium/chromoting/TrackingInputHandler.java b/remoting/android/java/src/org/chromium/chromoting/TrackingInputHandler.java
index 2eaa14a267321f452b7f2340d1b48b1530995a48..13dd289631f4a36d2a49b88476a3da16a7d914e4 100644
--- a/remoting/android/java/src/org/chromium/chromoting/TrackingInputHandler.java
+++ b/remoting/android/java/src/org/chromium/chromoting/TrackingInputHandler.java
@@ -114,7 +114,10 @@ public class TrackingInputHandler implements TouchInputHandler {
float xAdjust = 0;
float yAdjust = 0;
- if (leftDelta > 0 && rightDelta > 0) {
+ if (rectScreen[2] - rectScreen[0] < mRenderData.screenWidth) {
+ // Image is narrower than the screen, so center it.
+ xAdjust = -(rightDelta + leftDelta) / 2;
+ } else if (leftDelta > 0 && rightDelta > 0) {
// Panning the image left will show more of it.
xAdjust = -Math.min(leftDelta, rightDelta);
} else if (leftDelta < 0 && rightDelta < 0) {
@@ -123,7 +126,9 @@ public class TrackingInputHandler implements TouchInputHandler {
}
// Apply similar logic for yAdjust.
- if (topDelta > 0 && bottomDelta > 0) {
+ if (rectScreen[3] - rectScreen[1] < mRenderData.screenHeight) {
+ yAdjust = -(bottomDelta + topDelta) / 2;
+ } else if (topDelta > 0 && bottomDelta > 0) {
yAdjust = -Math.min(topDelta, bottomDelta);
} else if (topDelta < 0 && bottomDelta < 0) {
yAdjust = Math.min(-topDelta, -bottomDelta);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698