diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2012-01-24 15:20:27 +1000 |
---|---|---|
committer | Michael Brasser <michael.brasser@nokia.com> | 2012-01-24 06:30:05 +0100 |
commit | 3ac829b54653f518da7955262ca67108588967a9 (patch) | |
tree | 94bad3135e974f0bc18ea5dbc239b2ced4bc10aa /src/quick/util/qdeclarativesmoothedanimation.cpp | |
parent | 1f5b98c27e6175b2c0e58c92c4562fe3c408122f (diff) |
Fix regression in highlight animation.
Change-Id: Id8476ce3944094d48389f2ef24c0e26635e25c58
Reviewed-by: Michael Brasser <michael.brasser@nokia.com>
Diffstat (limited to 'src/quick/util/qdeclarativesmoothedanimation.cpp')
-rw-r--r-- | src/quick/util/qdeclarativesmoothedanimation.cpp | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/quick/util/qdeclarativesmoothedanimation.cpp b/src/quick/util/qdeclarativesmoothedanimation.cpp index 316d96cb0d..7a9ccaa739 100644 --- a/src/quick/util/qdeclarativesmoothedanimation.cpp +++ b/src/quick/util/qdeclarativesmoothedanimation.cpp @@ -98,6 +98,15 @@ QSmoothedAnimation::~QSmoothedAnimation() void QSmoothedAnimation::restart() { initialVelocity = trackVelocity; + if (isRunning()) + init(); + else + start(); +} + +void QSmoothedAnimation::prepareForRestart() +{ + initialVelocity = trackVelocity; if (isRunning()) { //we are joining a new wrapper group while running, our times need to be restarted useDelta = true; @@ -384,15 +393,15 @@ QAbstractAnimationJob* QDeclarativeSmoothedAnimation::transition(QDeclarativeSta QSet<QAbstractAnimationJob*> anims; for (int i = 0; i < dataActions.size(); i++) { QSmoothedAnimation *ease; - bool needsRestart; + bool isActive; if (!d->activeAnimations.contains(dataActions[i].property)) { ease = new QSmoothedAnimation(d); d->activeAnimations.insert(dataActions[i].property, ease); ease->target = dataActions[i].property; - needsRestart = false; + isActive = false; } else { ease = d->activeAnimations.value(dataActions[i].property); - needsRestart = true; + isActive = true; } wrapperGroup->appendAnimation(initInstance(ease)); @@ -406,8 +415,8 @@ QAbstractAnimationJob* QDeclarativeSmoothedAnimation::transition(QDeclarativeSta ease->initialVelocity = ease->trackVelocity; - if (needsRestart) - ease->restart(); + if (isActive) + ease->prepareForRestart(); anims.insert(ease); } |