diff options
author | Martin Jones <martin.jones@nokia.com> | 2010-04-28 03:06:06 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2010-04-28 03:06:06 (GMT) |
commit | 7ecfd4393149ce9b49e5da4e254fcecd6b8af420 (patch) | |
tree | 6665c23714a6de37406b323ff6f2ded5047cd4e6 /src | |
parent | 770c9b1568ab5cfd9d99cd1adf645da459b84da9 (diff) | |
download | Qt-7ecfd4393149ce9b49e5da4e254fcecd6b8af420.zip Qt-7ecfd4393149ce9b49e5da4e254fcecd6b8af420.tar.gz Qt-7ecfd4393149ce9b49e5da4e254fcecd6b8af420.tar.bz2 |
Fix snap at view boundaries with overshoot on.
The view would flick slowly at the boundaries if overshoot and snapping
was enabled.
Diffstat (limited to 'src')
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativegridview.cpp | 11 | ||||
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativelistview.cpp | 11 |
2 files changed, 14 insertions, 8 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp index f79a853..febd34a 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview.cpp +++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp @@ -855,10 +855,13 @@ void QDeclarativeGridViewPrivate::flick(AxisData &data, qreal minExtent, qreal m qreal adjDist = -data.flickTarget + data.move.value(); if (qAbs(adjDist) > qAbs(dist)) { // Prevent painfully slow flicking - adjust velocity to suit flickDeceleration - v2 = accel * 2.0f * qAbs(dist); - v = qSqrt(v2); - if (dist > 0) - v = -v; + qreal adjv2 = accel * 2.0f * qAbs(adjDist); + if (adjv2 > v2) { + v2 = adjv2; + v = qSqrt(v2); + if (dist > 0) + v = -v; + } } dist = adjDist; accel = v2 / (2.0f * qAbs(dist)); diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index c88dab2..3f150dc 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview.cpp +++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp @@ -1230,10 +1230,13 @@ void QDeclarativeListViewPrivate::flick(AxisData &data, qreal minExtent, qreal m qreal adjDist = -data.flickTarget + data.move.value(); if (qAbs(adjDist) > qAbs(dist)) { // Prevent painfully slow flicking - adjust velocity to suit flickDeceleration - v2 = accel * 2.0f * qAbs(dist); - v = qSqrt(v2); - if (dist > 0) - v = -v; + qreal adjv2 = accel * 2.0f * qAbs(adjDist); + if (adjv2 > v2) { + v2 = adjv2; + v = qSqrt(v2); + if (dist > 0) + v = -v; + } } dist = adjDist; accel = v2 / (2.0f * qAbs(dist)); |