Skip to content

Commit abde042

Browse files
committed
ScaleGestureDetector bugfixes
* Use radius, not diameter. * Properly determine initial span on ACTION_DOWN. Change-Id: Ia1dcff6589f8226181a9beaecef34440e9e16330
1 parent 4368ba4 commit abde042

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

core/java/android/view/ScaleGestureDetector.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ public boolean onTouchEvent(MotionEvent event) {
314314
}
315315
}
316316

317-
final boolean configChanged =
317+
final boolean configChanged = action == MotionEvent.ACTION_DOWN ||
318318
action == MotionEvent.ACTION_POINTER_UP ||
319319
action == MotionEvent.ACTION_POINTER_DOWN;
320320
final boolean pointerUp = action == MotionEvent.ACTION_POINTER_UP;
@@ -344,7 +344,7 @@ public boolean onTouchEvent(MotionEvent event) {
344344
if (skipIndex == i) continue;
345345

346346
// Average touch major and touch minor and convert the resulting diameter into a radius.
347-
final float touchSize = getAdjustedTouchHistory(event.getPointerId(i));
347+
final float touchSize = getAdjustedTouchHistory(event.getPointerId(i)) / 2;
348348
devSumX += Math.abs(event.getX(i) - focusX) + touchSize;
349349
devSumY += Math.abs(event.getY(i) - focusY) + touchSize;
350350
}

0 commit comments

Comments
 (0)