OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.chromoting; | 5 package org.chromium.chromoting; |
6 | 6 |
7 import android.content.Context; | 7 import android.content.Context; |
8 import android.graphics.Point; | 8 import android.graphics.Point; |
9 import android.os.SystemClock; | 9 import android.os.SystemClock; |
10 import android.view.MotionEvent; | 10 import android.view.MotionEvent; |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
146 @Override | 146 @Override |
147 public DesktopView.InputFeedbackType getLongPressFeedbackType() { | 147 public DesktopView.InputFeedbackType getLongPressFeedbackType() { |
148 return DesktopView.InputFeedbackType.LARGE_ANIMATION; | 148 return DesktopView.InputFeedbackType.LARGE_ANIMATION; |
149 } | 149 } |
150 | 150 |
151 @Override | 151 @Override |
152 public boolean isIndirectInputMode() { | 152 public boolean isIndirectInputMode() { |
153 return false; | 153 return false; |
154 } | 154 } |
155 | 155 |
156 private Point getCursorPosition() { | 156 private Point getCursorPosition() { |
joedow
2016/08/17 17:08:15
Why not use the floating point cursor position eve
Yuwei
2016/08/17 17:42:45
Done. Now using float everywhere and will convert
| |
157 synchronized (mRenderData) { | 157 synchronized (mRenderData) { |
158 return mRenderData.getCursorPosition(); | 158 return mRenderData.getIntegerCursorPosition(); |
159 } | 159 } |
160 } | 160 } |
161 | 161 |
162 private boolean isDoubleTap(int currentX, int currentY, long tapInterval) { | 162 private boolean isDoubleTap(int currentX, int currentY, long tapInterval) { |
163 if (tapInterval > mDoubleTapDurationInMs || mLastTapPoint == null) { | 163 if (tapInterval > mDoubleTapDurationInMs || mLastTapPoint == null) { |
164 return false; | 164 return false; |
165 } | 165 } |
166 | 166 |
167 // Convert the image based coordinates back to screen coordinates so the user experiences | 167 // Convert the image based coordinates back to screen coordinates so the user experiences |
168 // consistent double tap behavior regardless of zoom level. | 168 // consistent double tap behavior regardless of zoom level. |
169 // | 169 // |
170 float[] currentValues = {currentX, currentY}; | 170 float[] currentValues = {currentX, currentY}; |
171 float[] previousValues = {mLastTapPoint.x, mLastTapPoint.y}; | 171 float[] previousValues = {mLastTapPoint.x, mLastTapPoint.y}; |
172 synchronized (mRenderData) { | 172 synchronized (mRenderData) { |
173 mRenderData.transform.mapPoints(currentValues); | 173 mRenderData.transform.mapPoints(currentValues); |
174 mRenderData.transform.mapPoints(previousValues); | 174 mRenderData.transform.mapPoints(previousValues); |
175 } | 175 } |
176 | 176 |
177 int deltaX = (int) (currentValues[0] - previousValues[0]); | 177 int deltaX = (int) (currentValues[0] - previousValues[0]); |
178 int deltaY = (int) (currentValues[1] - previousValues[1]); | 178 int deltaY = (int) (currentValues[1] - previousValues[1]); |
179 return ((deltaX * deltaX + deltaY * deltaY) <= mDoubleTapSlopSquareInPx) ; | 179 return ((deltaX * deltaX + deltaY * deltaY) <= mDoubleTapSlopSquareInPx) ; |
180 } | 180 } |
181 } | 181 } |
OLD | NEW |