From: Martin Jones Date: Mon, 12 Sep 2011 02:40:20 +0000 (+1000) Subject: Port change 67ed1849 from Qt 4.7 X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=6a15dae8c2f09c99bb124b4587ff8088b35a7273;p=konrad%2Fqtdeclarative.git Port change 67ed1849 from Qt 4.7 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. Task-number: QT-4903 Change-Id: Ie4c2a3829026c0bf7d94cf5b60c0b7ff9833f725 Reviewed-on: http://codereview.qt-project.org/4618 Reviewed-by: Qt Sanity Bot Reviewed-by: Martin Jones --- diff --git a/src/declarative/items/qsgflickable.cpp b/src/declarative/items/qsgflickable.cpp index 962eb96..359d150 100644 --- a/src/declarative/items/qsgflickable.cpp +++ b/src/declarative/items/qsgflickable.cpp @@ -235,8 +235,8 @@ void QSGFlickablePrivate::AxisData::addVelocitySample(qreal v, qreal maxVelocity void QSGFlickablePrivate::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);