зеркало из https://github.com/mozilla/gecko-dev.git
Bug 856039 - (Cleanup) Extract magic number. r=Cwiiis
This commit is contained in:
Родитель
ca27e5333f
Коммит
3983b46b9c
|
@ -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++;
|
||||
|
|
Загрузка…
Ссылка в новой задаче