From a02a089e67277fde5a050f21d90ac322b1a1675a Mon Sep 17 00:00:00 2001 From: "Aaron J. Seigo" Date: Wed, 21 May 2008 05:12:40 +0000 Subject: [PATCH] fix math in here; the other types are also going to be wrong, but i haven't fixed those yet svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=810605 --- animationdriver.cpp | 2 +- animator.cpp | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/animationdriver.cpp b/animationdriver.cpp index b2d93888b..1dba02666 100644 --- a/animationdriver.cpp +++ b/animationdriver.cpp @@ -64,7 +64,7 @@ int AnimationDriver::movementAnimationDuration(Plasma::Animator::Movement moveme switch (movement) { case Animator::FastSlideInMovement: case Animator::FastSlideOutMovement: - return 100; + return 150; break; default: break; diff --git a/animator.cpp b/animator.cpp index 11c567fe2..5648011e1 100644 --- a/animator.cpp +++ b/animator.cpp @@ -33,6 +33,7 @@ namespace Plasma { +static const int MIN_TICK_RATE_INT = 40; static const qreal MIN_TICK_RATE = 40; struct AnimationState @@ -333,10 +334,13 @@ int Animator::moveItem(QGraphicsItem* item, Movement movement, const QPoint &des state->movement = movement; state->curve = d->driver->movementAnimationCurve(movement); //TODO: variance in times based on the value of animation - state->frames = frames / 2; + int duration = d->driver->movementAnimationDuration(movement); + state->frames = (duration / 1000.0) * frames; state->currentFrame = 0; - state->interval = d->driver->movementAnimationDuration(movement) / state->frames; - state->interval = (state->interval / MIN_TICK_RATE) * MIN_TICK_RATE; + state->interval = duration / state->frames; + state->interval -= qMax(MIN_TICK_RATE_INT, state->interval % MIN_TICK_RATE_INT); +// state->interval = (state->interval / MIN_TICK_RATE) * MIN_TICK_RATE; + //kDebug() << "interval of" << state->interval; state->currentInterval = state->interval; state->qobj = dynamic_cast(item); @@ -577,11 +581,13 @@ void Animator::timerEvent(QTimerEvent *event) qMax(1, elapsed / state->interval) : state->frames - state->currentFrame; if (state->currentFrame < state->frames) { + //kDebug() << "movement"; d->performMovement(d->calculateProgress(state->frames, state->currentFrame), state); //TODO: calculate a proper interval based on the curve state->currentInterval = state->interval; animationsRemain = true; } else { + //kDebug() << "movement"; d->performMovement(1, state); d->movingItems.erase(d->movingItems.find(state->item)); emit movementFinished(state->item);