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>
This commit is contained in:
parent
0ac0191111
commit
011b88a7b3
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user