Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 571c81e9 authored by Adam Powell's avatar Adam Powell Committed by The Android Automerger
Browse files

ScaleGestureDetector bugfixes

* Use radius, not diameter.

* Properly determine initial span on ACTION_DOWN.

Change-Id: Ia1dcff6589f8226181a9beaecef34440e9e16330
parent 6c673bac
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -314,7 +314,7 @@ public class ScaleGestureDetector {
            }
        }

        final boolean configChanged =
        final boolean configChanged = action == MotionEvent.ACTION_DOWN ||
                action == MotionEvent.ACTION_POINTER_UP ||
                action == MotionEvent.ACTION_POINTER_DOWN;
        final boolean pointerUp = action == MotionEvent.ACTION_POINTER_UP;
@@ -344,7 +344,7 @@ public class ScaleGestureDetector {
            if (skipIndex == i) continue;

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