mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-30 10:12:59 +00:00
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:
parent
0ec3bd25cf
commit
b230038f25
@ -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;
|
||||
}
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user