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
This commit is contained in:
parent
30dd547919
commit
a02a089e67
@ -64,7 +64,7 @@ int AnimationDriver::movementAnimationDuration(Plasma::Animator::Movement moveme
|
|||||||
switch (movement) {
|
switch (movement) {
|
||||||
case Animator::FastSlideInMovement:
|
case Animator::FastSlideInMovement:
|
||||||
case Animator::FastSlideOutMovement:
|
case Animator::FastSlideOutMovement:
|
||||||
return 100;
|
return 150;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
12
animator.cpp
12
animator.cpp
@ -33,6 +33,7 @@
|
|||||||
namespace Plasma
|
namespace Plasma
|
||||||
{
|
{
|
||||||
|
|
||||||
|
static const int MIN_TICK_RATE_INT = 40;
|
||||||
static const qreal MIN_TICK_RATE = 40;
|
static const qreal MIN_TICK_RATE = 40;
|
||||||
|
|
||||||
struct AnimationState
|
struct AnimationState
|
||||||
@ -333,10 +334,13 @@ int Animator::moveItem(QGraphicsItem* item, Movement movement, const QPoint &des
|
|||||||
state->movement = movement;
|
state->movement = movement;
|
||||||
state->curve = d->driver->movementAnimationCurve(movement);
|
state->curve = d->driver->movementAnimationCurve(movement);
|
||||||
//TODO: variance in times based on the value of animation
|
//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->currentFrame = 0;
|
||||||
state->interval = d->driver->movementAnimationDuration(movement) / state->frames;
|
state->interval = duration / state->frames;
|
||||||
state->interval = (state->interval / MIN_TICK_RATE) * MIN_TICK_RATE;
|
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->currentInterval = state->interval;
|
||||||
state->qobj = dynamic_cast<QObject*>(item);
|
state->qobj = dynamic_cast<QObject*>(item);
|
||||||
|
|
||||||
@ -577,11 +581,13 @@ void Animator::timerEvent(QTimerEvent *event)
|
|||||||
qMax(1, elapsed / state->interval) : state->frames - state->currentFrame;
|
qMax(1, elapsed / state->interval) : state->frames - state->currentFrame;
|
||||||
|
|
||||||
if (state->currentFrame < state->frames) {
|
if (state->currentFrame < state->frames) {
|
||||||
|
//kDebug() << "movement";
|
||||||
d->performMovement(d->calculateProgress(state->frames, state->currentFrame), state);
|
d->performMovement(d->calculateProgress(state->frames, state->currentFrame), state);
|
||||||
//TODO: calculate a proper interval based on the curve
|
//TODO: calculate a proper interval based on the curve
|
||||||
state->currentInterval = state->interval;
|
state->currentInterval = state->interval;
|
||||||
animationsRemain = true;
|
animationsRemain = true;
|
||||||
} else {
|
} else {
|
||||||
|
//kDebug() << "movement";
|
||||||
d->performMovement(1, state);
|
d->performMovement(1, state);
|
||||||
d->movingItems.erase(d->movingItems.find(state->item));
|
d->movingItems.erase(d->movingItems.find(state->item));
|
||||||
emit movementFinished(state->item);
|
emit movementFinished(state->item);
|
||||||
|
Loading…
Reference in New Issue
Block a user