Bug 1063224 - Add a PanStart() method to AsyncPanZoomController. r=kats

--HG--
extra : source : c26cacfcd1998dddd2982062c844e10bc5736541
This commit is contained in:
Botond Ballo 2014-09-05 18:42:03 -04:00
parent 1b53050363
commit 60dc6f5474
4 changed files with 26 additions and 3 deletions

View File

@ -1726,6 +1726,10 @@ float AsyncPanZoomController::PanDistance() const {
return NS_hypot(mX.PanDistance(), mY.PanDistance());
}
ScreenPoint AsyncPanZoomController::PanStart() const {
return ScreenPoint(mX.PanStart(), mY.PanStart());
}
const ScreenPoint AsyncPanZoomController::GetVelocityVector() {
return ScreenPoint(mX.GetVelocity(), mY.GetVelocity());
}

View File

@ -488,6 +488,16 @@ protected:
*/
float PanDistance() const;
/**
* Gets the start point of the current touch.
* Like PanDistance(), this only makes sense if a touch is currently
* happening and OnTouchMove() or the equivalent for pan gestures is
* being invoked.
* Unlikely PanDistance(), this function returns a point in local screen
* coordinates.
*/
ScreenPoint PanStart() const;
/**
* Gets a vector of the velocities of each axis.
*/

View File

@ -207,6 +207,10 @@ void Axis::ClearOverscroll() {
mOverscroll = 0;
}
ScreenCoord Axis::PanStart() const {
return mStartPos;
}
ScreenCoord Axis::PanDistance() const {
return fabs(mPos - mStartPos);
}

View File

@ -118,16 +118,21 @@ public:
*/
void ClearOverscroll();
/**
* Gets the starting position of the touch supplied in StartTouch().
*/
ScreenCoord PanStart() const;
/**
* Gets the distance between the starting position of the touch supplied in
* startTouch() and the current touch from the last
* updateWithTouchAtDevicePoint().
* StartTouch() and the current touch from the last
* UpdateWithTouchAtDevicePoint().
*/
ScreenCoord PanDistance() const;
/**
* Gets the distance between the starting position of the touch supplied in
* startTouch() and the supplied position.
* StartTouch() and the supplied position.
*/
ScreenCoord PanDistance(ScreenCoord aPos) const;