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

Commit acd944cc authored by Huahui Wu's avatar Huahui Wu
Browse files

b/3331379 reduce ping-to-zoom jitter.

Change-Id: I522c86661777e670776b9fb448dc3333cef8b77b
parent f2e48873
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -149,6 +149,12 @@ class ZoomManager {

    private static float MINIMUM_SCALE_INCREMENT = 0.01f;

    /*
     *  The touch points could be changed even the fingers stop moving.
     *  We use the following to filter out the zooming jitters.
     */
    private static float MINIMUM_SCALE_WITHOUT_JITTER = 0.05f;

    /*
     * The following member variables are only to be used for animating zoom. If
     * mZoomScale is non-zero then we are in the middle of a zoom animation. The
@@ -684,6 +690,10 @@ class ZoomManager {
                } else {
                    scale = Math.max(scale, mActualScale * 0.8f);
                }
                // 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;
                }
                setZoomCenter(detector.getFocusX(), detector.getFocusY());
                setZoomScale(scale, false);
                mWebView.invalidate();