Bug 734496 - Don't apply resistance to pinch zoom unless an axis is in overscroll on both sides. r=Cwiiis

This commit is contained in:
Kartikaya Gupta 2012-08-11 13:32:04 -04:00
parent 0ec3bd25cf
commit b230038f25
2 changed files with 4 additions and 4 deletions

View File

@ -216,9 +216,9 @@ abstract class Axis {
* Returns the resistance, as a multiplier, that should be taken into account when
* tracking or pinching.
*/
float getEdgeResistance() {
float getEdgeResistance(boolean forPinching) {
float excess = getExcess();
if (excess > 0.0f) {
if (excess > 0.0f && (getOverscroll() == Overscroll.BOTH || !forPinching)) {
// excess can be greater than viewport length, but the resistance
// must never drop below 0.0
return Math.max(0.0f, SNAP_LIMIT - excess / getViewportLength());
@ -299,7 +299,7 @@ abstract class Axis {
}
if (mFlingState == FlingStates.PANNING)
mDisplacement += (mLastTouchPos - mTouchPos) * getEdgeResistance();
mDisplacement += (mLastTouchPos - mTouchPos) * getEdgeResistance(false);
else
mDisplacement += mVelocity;
}

View File

@ -921,7 +921,7 @@ public class PanZoomController
* Apply edge resistance if we're zoomed out smaller than the page size by scaling the zoom
* factor toward 1.0.
*/
float resistance = Math.min(mX.getEdgeResistance(), mY.getEdgeResistance());
float resistance = Math.min(mX.getEdgeResistance(true), mY.getEdgeResistance(true));
if (spanRatio > 1.0f)
spanRatio = 1.0f + (spanRatio - 1.0f) * resistance;
else