Merge "b/3331379 reduce ping-to-zoom jitter." into honeycomb

This commit is contained in:
Huahui Wu
2011-01-11 13:59:46 -08:00
committed by Android (Google) Code Review

View File

@@ -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();