зеркало из https://github.com/mozilla/pjs.git
Bug 704738 - Resize page content on device rotation. r=Cwiiis a=java-only
Some cleanup: ensure we abort and re-bounce the viewport if the device is rotated during a double-tap zoom. Also rename variables to be more appropriate
This commit is contained in:
Родитель
87f29234cb
Коммит
5c1b4941f0
|
@ -258,9 +258,9 @@ public class LayerController {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Informs the pan/zoom controller that the viewport metrics changed. */
|
/** Informs the pan/zoom controller that the viewport metrics changed. */
|
||||||
public void notifyPanZoomControllerOfGeometryChange(boolean abortFling) {
|
public void notifyPanZoomControllerOfGeometryChange(boolean abortAnimation) {
|
||||||
if (mPanZoomController != null)
|
if (mPanZoomController != null)
|
||||||
mPanZoomController.geometryChanged(abortFling);
|
mPanZoomController.geometryChanged(abortAnimation);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -136,8 +136,7 @@ public class PanZoomController
|
||||||
* similar to TOUCHING but after starting a pan */
|
* similar to TOUCHING but after starting a pan */
|
||||||
PANNING_HOLD_LOCKED, /* like PANNING_HOLD, but axis lock still in effect */
|
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 */
|
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 */
|
||||||
BOUNCING, /* bouncing back */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private PanZoomState mState;
|
private PanZoomState mState;
|
||||||
|
@ -241,16 +240,21 @@ public class PanZoomController
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void geometryChanged(boolean aAbortFling) {
|
public void geometryChanged(boolean abortAnimation) {
|
||||||
if (aAbortFling) {
|
if (abortAnimation) {
|
||||||
// this happens when gecko changes the viewport on us. if that's the case, abort
|
// this happens when gecko changes the viewport on us or if the device is rotated.
|
||||||
// any fling that's in progress and re-fling so that the page snaps to edges. for
|
// if that's the case, abort any animation in progress and re-zoom so that the page
|
||||||
// other cases (where the user's finger(s) are down) don't do anything special.
|
// snaps to edges. for other cases (where the user's finger(s) are down) don't do
|
||||||
|
// anything special.
|
||||||
switch (mState) {
|
switch (mState) {
|
||||||
case FLING:
|
case FLING:
|
||||||
mX.velocity = mY.velocity = 0.0f;
|
mX.velocity = mY.velocity = 0.0f;
|
||||||
mState = PanZoomState.NOTHING;
|
mState = PanZoomState.NOTHING;
|
||||||
// fall through
|
// fall through
|
||||||
|
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 and start a new one to
|
||||||
|
// ensure the viewport doesn't contain out-of-bounds areas
|
||||||
case NOTHING:
|
case NOTHING:
|
||||||
bounce();
|
bounce();
|
||||||
break;
|
break;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче