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

Commit 61bb9119 authored by Shimeng (Simon) Wang's avatar Shimeng (Simon) Wang
Browse files

Make sure pinch zoom and overview scale are within limits

issue: 3482463
Change-Id: I9d746883c03326bdfa7fb0373ffadfbc75f69087
parent 7e8a69ed
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -629,7 +629,7 @@ class ZoomManager {
    }

    /* package */ float getZoomOverviewScale() {
        return mWebView.getViewWidth() * mInvZoomOverviewWidth;
        return computeScaleWithLimits(mWebView.getViewWidth() * mInvZoomOverviewWidth);
    }

    public boolean isInZoomOverview() {
@@ -722,7 +722,8 @@ class ZoomManager {

        public boolean onScale(ScaleGestureDetector detector) {
            // Prevent scaling beyond overview scale.
            float scale = Math.max(detector.getScaleFactor() * mActualScale,
            float scale = Math.max(
                    computeScaleWithLimits(detector.getScaleFactor() * mActualScale),
                    getZoomOverviewScale());
            if (mPinchToZoomAnimating || willScaleTriggerZoom(scale)) {
                mPinchToZoomAnimating = true;
@@ -732,6 +733,7 @@ class ZoomManager {
                } else {
                    scale = Math.max(scale, mActualScale * 0.8f);
                }
                scale = computeScaleWithLimits(scale);
                // if the scale change is too small, regard it as jitter and skip it.
                if (Math.abs(scale - mActualScale) < MINIMUM_SCALE_WITHOUT_JITTER) {
                    return false;