diff options
| author | 2011-06-08 14:04:33 -0700 | |
|---|---|---|
| committer | 2011-06-08 14:04:33 -0700 | |
| commit | 92110af24a9a93b73264560b57f55f45ec65dab5 (patch) | |
| tree | 22a9f3f2b2d124e401d327050ca2cb216f9cd934 /services/input/InputReader.cpp | |
| parent | 0da86d4fef70f94a02a504f8500df2833719da6b (diff) | |
| parent | 5f0b1721eece5ca614044cda638f11fbec0eab0a (diff) | |
am 5f0b1721: am 25bd8abc: Merge "Fix swipe gesture cosine calculation. Bug: 4124987" into honeycomb-mr2
* commit '5f0b1721eece5ca614044cda638f11fbec0eab0a':
Fix swipe gesture cosine calculation. Bug: 4124987
Diffstat (limited to 'services/input/InputReader.cpp')
| -rw-r--r-- | services/input/InputReader.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/services/input/InputReader.cpp b/services/input/InputReader.cpp index ce8a939742ad..1ed5ad729fc2 100644 --- a/services/input/InputReader.cpp +++ b/services/input/InputReader.cpp @@ -3940,7 +3940,11 @@ bool TouchInputMapper::preparePointerGestures(nsecs_t when, // approches 1.0. Recall that dot(v1, v2) = cos(angle) * mag(v1) * mag(v2). PointerGesture::Delta& delta1 = mPointerGesture.referenceDeltas[id1]; PointerGesture::Delta& delta2 = mPointerGesture.referenceDeltas[id2]; - float dot = delta1.dx * delta2.dx + delta1.dy * delta2.dy; + float dx1 = delta1.dx * mLocked.pointerGestureXZoomScale; + float dy1 = delta1.dy * mLocked.pointerGestureYZoomScale; + float dx2 = delta2.dx * mLocked.pointerGestureXZoomScale; + float dy2 = delta2.dy * mLocked.pointerGestureYZoomScale; + float dot = dx1 * dx2 + dy1 * dy2; float cosine = dot / (dist1 * dist2); // denominator always > 0 if (cosine >= mConfig->pointerGestureSwipeTransitionAngleCosine) { // Pointers are moving in the same direction. Switch to SWIPE. |