mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-11 04:15:43 +00:00
Bug 735248 - Add a BOUNCE state to track bounce animations, and disable redraws while we are in a bounce. r=Cwiiis
This commit is contained in:
parent
d765a470db
commit
7640cb963c
@ -119,7 +119,8 @@ public class PanZoomController
|
||||
* similar to TOUCHING but after starting a pan */
|
||||
PANNING_HOLD_LOCKED, /* like PANNING_HOLD, but axis lock still in effect */
|
||||
PINCHING, /* nth touch-start, where n > 1. this mode allows pan and zoom */
|
||||
ANIMATED_ZOOM /* animated zoom to a new rect */
|
||||
ANIMATED_ZOOM, /* animated zoom to a new rect */
|
||||
BOUNCE /* in a bounce animation */
|
||||
}
|
||||
|
||||
private final LayerController mController;
|
||||
@ -221,11 +222,12 @@ public class PanZoomController
|
||||
case FLING:
|
||||
mX.stopFling();
|
||||
mY.stopFling();
|
||||
mState = PanZoomState.NOTHING;
|
||||
// fall through
|
||||
case BOUNCE:
|
||||
case ANIMATED_ZOOM:
|
||||
// the zoom that's in progress likely makes no sense any more (such as if
|
||||
// the screen orientation changed) so abort it
|
||||
mState = PanZoomState.NOTHING;
|
||||
// fall through
|
||||
case NOTHING:
|
||||
// Don't do animations here; they're distracting and can cause flashes on page
|
||||
@ -263,6 +265,7 @@ public class PanZoomController
|
||||
case ANIMATED_ZOOM:
|
||||
return false;
|
||||
case FLING:
|
||||
case BOUNCE:
|
||||
case NOTHING:
|
||||
startTouch(event.getX(0), event.getY(0), event.getEventTime());
|
||||
return false;
|
||||
@ -284,6 +287,7 @@ public class PanZoomController
|
||||
switch (mState) {
|
||||
case NOTHING:
|
||||
case FLING:
|
||||
case BOUNCE:
|
||||
// should never happen
|
||||
Log.e(LOGTAG, "Received impossible touch move while in " + mState);
|
||||
return false;
|
||||
@ -329,6 +333,7 @@ public class PanZoomController
|
||||
switch (mState) {
|
||||
case NOTHING:
|
||||
case FLING:
|
||||
case BOUNCE:
|
||||
// should never happen
|
||||
Log.e(LOGTAG, "Received impossible touch end while in " + mState);
|
||||
return false;
|
||||
@ -462,7 +467,7 @@ public class PanZoomController
|
||||
return;
|
||||
}
|
||||
|
||||
mState = PanZoomState.FLING;
|
||||
mState = PanZoomState.BOUNCE;
|
||||
|
||||
startAnimationTimer(new BounceRunnable(bounceStartMetrics, metrics));
|
||||
}
|
||||
@ -575,7 +580,7 @@ public class PanZoomController
|
||||
* animation by setting the state to PanZoomState.NOTHING. Handle this case and bail
|
||||
* out.
|
||||
*/
|
||||
if (mState != PanZoomState.FLING) {
|
||||
if (mState != PanZoomState.BOUNCE) {
|
||||
finishAnimation();
|
||||
return;
|
||||
}
|
||||
@ -830,7 +835,18 @@ public class PanZoomController
|
||||
}
|
||||
|
||||
public boolean getRedrawHint() {
|
||||
return (mState != PanZoomState.PINCHING && mState != PanZoomState.ANIMATED_ZOOM);
|
||||
switch (mState) {
|
||||
case PINCHING:
|
||||
case ANIMATED_ZOOM:
|
||||
case BOUNCE:
|
||||
// don't redraw during these because the zoom is (or might be, in the case
|
||||
// of BOUNCE) be changing rapidly and gecko will have to redraw the entire
|
||||
// display port area. we trigger a force-redraw upon exiting these states.
|
||||
return false;
|
||||
default:
|
||||
// allow redrawing in other states
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private void sendPointToGecko(String event, MotionEvent motionEvent) {
|
||||
|
Loading…
Reference in New Issue
Block a user