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

Commit 88ec644d authored by Shimeng (Simon) Wang's avatar Shimeng (Simon) Wang
Browse files

Prevent scaling beyond zoom overview scale.

issue: 3243899
Change-Id: I1d6cbb1b1f75c7aadb3b9cc6e82d912217508dc4
parent 09437866
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -580,7 +580,7 @@ class ZoomManager {
        mInvZoomOverviewWidth = 1.0f / width;
    }

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

@@ -672,7 +672,10 @@ class ZoomManager {
        }

        public boolean onScale(ScaleGestureDetector detector) {
            float scale = Math.round(detector.getScaleFactor() * mActualScale * 100) * 0.01f;
            // Prevent scaling beyond overview scale.
            float scale = Math.max(
                Math.round(detector.getScaleFactor() * mActualScale * 100) * 0.01f,
                getZoomOverviewScale());
            if (willScaleTriggerZoom(scale)) {
                mPinchToZoomAnimating = true;
                // limit the scale change per step