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

Commit c37308f1 authored by Adam Powell's avatar Adam Powell
Browse files

Fix bug 4083825 - Gesture zoom locked along content edges under some

circumstances

Tune the procedure used to handle "zoom slop" during a webview
pan+zoom gesture.

Change-Id: Ia706722ba6a46e64cce8814d4668e3857b16e562
parent 92f2f3ff
Loading
Loading
Loading
Loading
+12 −2
Original line number Diff line number Diff line
@@ -777,12 +777,15 @@ class ZoomManager {
    }

    private class ScaleDetectorListener implements ScaleGestureDetector.OnScaleGestureListener {
        private float mAccumulatedSpan;

        public boolean onScaleBegin(ScaleGestureDetector detector) {
            mInitialZoomOverview = false;
            dismissZoomPicker();
            mFocusMovementQueue.clear();
            mWebView.mViewManager.startZoom();
            mWebView.onPinchToZoomAnimationStart();
            mAccumulatedSpan = 0;
            return true;
        }

@@ -797,8 +800,15 @@ class ZoomManager {
                    FloatMath.sqrt((mFocusX - prevFocusX) * (mFocusX - prevFocusX)
                                   + (mFocusY - prevFocusY) * (mFocusY - prevFocusY));
            mFocusMovementQueue.add(focusDelta);
            float deltaSpan = Math.abs(detector.getCurrentSpan() - detector.getPreviousSpan());
            return mFocusMovementQueue.getSum() > deltaSpan;
            float deltaSpan = detector.getCurrentSpan() - detector.getPreviousSpan() +
                    mAccumulatedSpan;
            final boolean result = mFocusMovementQueue.getSum() > Math.abs(deltaSpan);
            if (result) {
                mAccumulatedSpan += deltaSpan;
            } else {
                mAccumulatedSpan = 0;
            }
            return result;
        }

        public boolean handleScale(ScaleGestureDetector detector) {