summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlberto Mardegan <mardy@users.sourceforge.net>2011-12-18 19:12:42 +0200
committerQt by Nokia <qt-info@nokia.com>2012-04-12 15:11:10 +0200
commit011b88a7b37680288944bde2c4769fd203ee8218 (patch)
tree56f4b950f211e7f98c2c11155f791fa30e3d9000 /src
parent0ac019111137b13788468ddb3c020302f1a25038 (diff)
Compute overshoot condition before snap points
Snap points are not needed if the overshoot condition is met; therefore, move the overshoot handling before the computation of snap points. Change-Id: I37556b10c1b1124eaed53b0f2a330085acf70776 Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
Diffstat (limited to 'src')
-rw-r--r--src/widgets/util/qscroller.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/widgets/util/qscroller.cpp b/src/widgets/util/qscroller.cpp
index e39ed9c0a5..2c8b617761 100644
--- a/src/widgets/util/qscroller.cpp
+++ b/src/widgets/util/qscroller.cpp
@@ -1293,6 +1293,16 @@ void QScrollerPrivate::createScrollingSegments(qreal v, qreal startPos,
qScrollerDebug() << " Real Delta:" << deltaPos;
+ // -- check if are in overshoot and end in overshoot
+ if ((startPos < minPos && endPos < minPos) ||
+ (startPos > maxPos && endPos > maxPos)) {
+ qreal stopPos = endPos < minPos ? minPos : maxPos;
+ qreal oDeltaTime = sp->overshootScrollTime;
+
+ pushSegment(ScrollTypeOvershoot, oDeltaTime * qreal(0.7), qreal(1.0), startPos, stopPos - startPos, stopPos, sp->scrollingCurve.type(), orientation);
+ return;
+ }
+
// -- determine snap points
qreal nextSnap = nextSnapPos(endPos, 0, orientation);
qreal lowerSnapPos = nextSnapPos(startPos, -1, orientation);
@@ -1306,16 +1316,6 @@ void QScrollerPrivate::createScrollingSegments(qreal v, qreal startPos,
if (nextSnap < lowerSnapPos || qIsNaN(lowerSnapPos))
lowerSnapPos = nextSnap;
- // -- check if are in overshoot and end in overshoot
- if ((startPos < minPos && endPos < minPos) ||
- (startPos > maxPos && endPos > maxPos)) {
- qreal stopPos = endPos < minPos ? minPos : maxPos;
- qreal oDeltaTime = sp->overshootScrollTime;
-
- pushSegment(ScrollTypeOvershoot, oDeltaTime * qreal(0.7), qreal(1.0), startPos, stopPos - startPos, stopPos, sp->scrollingCurve.type(), orientation);
- return;
- }
-
if (qAbs(v) < sp->minimumVelocity) {
qScrollerDebug() << "### below minimum Vel" << orientation;