From 51f869699ed4e91860ee58579832ec986a971f12 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Thu, 1 Dec 2011 11:48:59 +1000 Subject: [PATCH] Ensure flickable velocity is updated when under heavy load. If the Flickable is forced to move very quickly due to highlight motion the smoothed velocity animation may not have an opportunity to run before being reset, resulting in the velocity not being updated. In this case just set the velocity directly since the motion is driven by an animation anyway. Change-Id: I1e5e9396f4c1cd12e95c6ac47941dad25e4aa897 Reviewed-by: Andrew den Exter --- src/declarative/items/qquickflickable.cpp | 10 ++++++++-- 1 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/declarative/items/qquickflickable.cpp b/src/declarative/items/qquickflickable.cpp index 2f7b744..aca3542 100644 --- a/src/declarative/items/qquickflickable.cpp +++ b/src/declarative/items/qquickflickable.cpp @@ -1177,13 +1177,19 @@ void QQuickFlickable::viewportMoved() qreal horizontalVelocity = (prevX - d->hData.move.value()) * 1000 / elapsed; if (qAbs(horizontalVelocity) > 0) { d->velocityTimeline.reset(d->hData.smoothVelocity); - d->velocityTimeline.move(d->hData.smoothVelocity, horizontalVelocity, d->reportedVelocitySmoothing); + if (d->calcVelocity) + d->velocityTimeline.set(d->hData.smoothVelocity, horizontalVelocity); + else + d->velocityTimeline.move(d->hData.smoothVelocity, horizontalVelocity, d->reportedVelocitySmoothing); d->velocityTimeline.move(d->hData.smoothVelocity, 0, d->reportedVelocitySmoothing); } qreal verticalVelocity = (prevY - d->vData.move.value()) * 1000 / elapsed; if (qAbs(verticalVelocity) > 0) { d->velocityTimeline.reset(d->vData.smoothVelocity); - d->velocityTimeline.move(d->vData.smoothVelocity, verticalVelocity, d->reportedVelocitySmoothing); + if (d->calcVelocity) + d->velocityTimeline.set(d->vData.smoothVelocity, verticalVelocity); + else + d->velocityTimeline.move(d->vData.smoothVelocity, verticalVelocity, d->reportedVelocitySmoothing); d->velocityTimeline.move(d->vData.smoothVelocity, 0, d->reportedVelocitySmoothing); } } -- 1.7.2.5