Bug 712386 - Limit how much zoom can be applied. r=Cwiiis

This commit is contained in:
Kartikaya Gupta 2011-12-27 00:56:57 -05:00
parent bd9005b059
commit 954005ec2a

View File

@ -937,6 +937,14 @@ public class PanZoomController
synchronized (mController) {
float newZoomFactor = mController.getZoomFactor() * spanRatio;
if (newZoomFactor >= MAX_ZOOM) {
// apply resistance when zooming past MAX_ZOOM,
// such that it asymptotically reaches MAX_ZOOM + 1.0
// but never exceeds that
float excessZoom = newZoomFactor - MAX_ZOOM;
excessZoom = 1.0f - (float)Math.exp(-excessZoom);
newZoomFactor = MAX_ZOOM + excessZoom;
}
mController.scrollBy(new PointF(mLastZoomFocus.x - detector.getFocusX(),
mLastZoomFocus.y - detector.getFocusY()));