mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 03:45:46 +00:00
Bug 706891 part 1 - Rename Axis setLocked/mLocked to setScrolledDisabled/mScrollingDisabled to clarify meaning. r=kats
This commit is contained in:
parent
5e22b7de58
commit
307a888c50
@ -88,7 +88,7 @@ abstract class Axis {
|
||||
private float mTouchPos; /* Position of the most recent touch event on the current drag. */
|
||||
private float mLastTouchPos; /* Position of the touch event before touchPos. */
|
||||
private float mVelocity; /* Velocity in this direction; pixels per animation frame. */
|
||||
private boolean mLocked; /* Whether movement on this axis is locked. */
|
||||
public boolean mScrollingDisabled; /* Whether movement on this axis is locked. */
|
||||
private boolean mDisableSnap; /* Whether overscroll snapping is disabled. */
|
||||
private float mDisplacement;
|
||||
|
||||
@ -108,7 +108,7 @@ abstract class Axis {
|
||||
|
||||
void startTouch(float pos) {
|
||||
mVelocity = 0.0f;
|
||||
mLocked = false;
|
||||
mScrollingDisabled = false;
|
||||
mFirstTouchPos = mTouchPos = mLastTouchPos = pos;
|
||||
}
|
||||
|
||||
@ -116,8 +116,8 @@ abstract class Axis {
|
||||
return currentPos - mFirstTouchPos;
|
||||
}
|
||||
|
||||
void setLocked(boolean locked) {
|
||||
mLocked = locked;
|
||||
void setScrollingDisabled(boolean disabled) {
|
||||
mScrollingDisabled = disabled;
|
||||
}
|
||||
|
||||
void saveTouchPos() {
|
||||
@ -172,11 +172,12 @@ abstract class Axis {
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns true if the page is zoomed in to some degree along this axis such that scrolling
|
||||
* is possible. Otherwise, returns false.
|
||||
* Returns true if the page is zoomed in to some degree along this axis such that scrolling is
|
||||
* possible and this axis has not been scroll locked while panning. Otherwise, returns false.
|
||||
*/
|
||||
private boolean scrollable() {
|
||||
return getViewportLength() <= getPageLength() - MIN_SCROLLABLE_DISTANCE;
|
||||
return getViewportLength() <= getPageLength() - MIN_SCROLLABLE_DISTANCE &&
|
||||
!mScrollingDisabled;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -195,7 +196,7 @@ abstract class Axis {
|
||||
|
||||
/* Returns the velocity. If the axis is locked, returns 0. */
|
||||
float getRealVelocity() {
|
||||
return (mLocked || !scrollable()) ? 0.0f : mVelocity;
|
||||
return scrollable() ? mVelocity : 0f;
|
||||
}
|
||||
|
||||
void startPan() {
|
||||
@ -253,7 +254,7 @@ abstract class Axis {
|
||||
|
||||
// Performs displacement of the viewport position according to the current velocity.
|
||||
void displace() {
|
||||
if (!mSubscroller.scrolling() && (mLocked || !scrollable()))
|
||||
if (!mSubscroller.scrolling() && !scrollable())
|
||||
return;
|
||||
|
||||
if (mFlingState == FlingStates.PANNING)
|
||||
|
@ -387,17 +387,17 @@ public class PanZoomController
|
||||
angle = Math.abs(angle); // range [0, pi]
|
||||
if (angle < AXIS_LOCK_ANGLE || angle > (Math.PI - AXIS_LOCK_ANGLE)) {
|
||||
// lock to x-axis
|
||||
mX.setLocked(false);
|
||||
mY.setLocked(true);
|
||||
mX.setScrollingDisabled(false);
|
||||
mY.setScrollingDisabled(true);
|
||||
} else if (Math.abs(angle - (Math.PI / 2)) < AXIS_LOCK_ANGLE) {
|
||||
// lock to y-axis
|
||||
mX.setLocked(true);
|
||||
mY.setLocked(false);
|
||||
mX.setScrollingDisabled(true);
|
||||
mY.setScrollingDisabled(false);
|
||||
} else {
|
||||
// break axis lock but log the angle so we can fine-tune this when people complain
|
||||
mState = PanZoomState.PANNING;
|
||||
mX.setLocked(false);
|
||||
mY.setLocked(false);
|
||||
mX.setScrollingDisabled(false);
|
||||
mY.setScrollingDisabled(false);
|
||||
angle = Math.abs(angle - (Math.PI / 2)); // range [0, pi/2]
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user