Bug 856039 - (Cleanup) Extract magic number. r=Cwiiis

This commit is contained in:
Kartikaya Gupta 2013-04-01 10:16:00 -04:00
Родитель ca27e5333f
Коммит 3983b46b9c
1 изменённых файлов: 5 добавлений и 2 удалений

Просмотреть файл

@ -69,6 +69,9 @@ class JavaPanZoomController
// The maximum zoom factor adjustment per frame of the AUTONAV animation
private static final float MAX_ZOOM_DELTA = 0.125f;
// Length of the bounce animation in ms
private static final int BOUNCE_ANIMATION_DURATION = 250;
private enum PanZoomState {
NOTHING, /* no touch-start events received */
FLING, /* all touches removed, but we're still scrolling page */
@ -808,7 +811,7 @@ class JavaPanZoomController
}
/* Perform the next frame of the bounce-back animation. */
if (mBounceFrame < (int)(256f/Axis.MS_PER_FRAME)) {
if (mBounceFrame < (int)(BOUNCE_ANIMATION_DURATION / Axis.MS_PER_FRAME)) {
advanceBounce();
return;
}
@ -822,7 +825,7 @@ class JavaPanZoomController
/* Performs one frame of a bounce animation. */
private void advanceBounce() {
synchronized (mTarget.getLock()) {
float t = easeOut(mBounceFrame * Axis.MS_PER_FRAME / 256f);
float t = easeOut(mBounceFrame * Axis.MS_PER_FRAME / BOUNCE_ANIMATION_DURATION);
ImmutableViewportMetrics newMetrics = mBounceStartMetrics.interpolate(mBounceEndMetrics, t);
mTarget.setViewportMetrics(newMetrics);
mBounceFrame++;