From 67ed18497705fa938728c505d165173dc5d3de68 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Wed, 25 May 2011 13:01:33 +1000 Subject: Flickable could flick in wrong direction if given too few touch samples If we got <= QML_FLICK_DISCARDSAMPLES the previous velocity was not cleared, so the view would continue flicking with the previous velocity, and therefore the previous direction. Change-Id: I876610f4522f32c814449309b01ec3787c5f6cc6 Task-number: QT-4903 Reviewed-by: Andrew den Exter --- src/declarative/graphicsitems/qdeclarativeflickable.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/declarative/graphicsitems/qdeclarativeflickable.cpp b/src/declarative/graphicsitems/qdeclarativeflickable.cpp index 82ed18c..2bf863b 100644 --- a/src/declarative/graphicsitems/qdeclarativeflickable.cpp +++ b/src/declarative/graphicsitems/qdeclarativeflickable.cpp @@ -232,8 +232,8 @@ void QDeclarativeFlickablePrivate::AxisData::addVelocitySample(qreal v, qreal ma void QDeclarativeFlickablePrivate::AxisData::updateVelocity() { + velocity = 0; if (velocityBuffer.count() > QML_FLICK_DISCARDSAMPLES) { - velocity = 0; int count = velocityBuffer.count()-QML_FLICK_DISCARDSAMPLES; for (int i = 0; i < count; ++i) { qreal v = velocityBuffer.at(i); -- cgit v0.12