summaryrefslogtreecommitdiffstats
path: root/qkineticscroller.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'qkineticscroller.cpp')
-rw-r--r--qkineticscroller.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/qkineticscroller.cpp b/qkineticscroller.cpp
index d963d82..f2888a4 100644
--- a/qkineticscroller.cpp
+++ b/qkineticscroller.cpp
@@ -932,6 +932,8 @@ void QKineticScroller::scrollTo(const QPointF &pos, int scrollTime)
d->scrollToX = true;
d->scrollToY = true;
d->releaseVelocity = v;
+ d->scrollRelativeTimer.restart();
+ d->scrollAbsoluteTimer.restart();
d->setState(QKineticScroller::StateScrolling);
}
@@ -1005,16 +1007,20 @@ void QKineticScrollerPrivate::setContentPositionHelper(const QPointF &deltaPos)
// --- handle overshooting and stop if the coordinate is going back inside the normal area
bool alwaysOvershoot = (overshootPolicy == QKineticScroller::OvershootAlwaysOn);
-
- qreal oldOvershootX = (maxPos.x() || alwaysOvershoot) ? oldPos.x() - oldClampedPos.x() : 0;
- qreal oldOvershootY = (maxPos.y() || alwaysOvershoot) ? oldPos.y() - oldClampedPos.y() : 0;
- if (state == QKineticScroller::StateDragging) {
+ bool noOvershoot = (overshootPolicy == QKineticScroller::OvershootAlwaysOff) ||
+ ((state == QKineticScroller::StateDragging) && !overshootDragResistanceFactor);
+ bool canOvershootX = !noOvershoot && (alwaysOvershoot || maxPos.x());
+ bool canOvershootY = !noOvershoot && (alwaysOvershoot || maxPos.y());
+
+ qreal oldOvershootX = (canOvershootX) ? oldPos.x() - oldClampedPos.x() : 0;
+ qreal oldOvershootY = (canOvershootY) ? oldPos.y() - oldClampedPos.y() : 0;
+ if (state == QKineticScroller::StateDragging && overshootDragResistanceFactor) {
oldOvershootX /= overshootDragResistanceFactor;
oldOvershootY /= overshootDragResistanceFactor;
}
- qreal newOvershootX = (maxPos.x() || alwaysOvershoot) ? newPos.x() - newClampedPos.x() : 0;
- qreal newOvershootY = (maxPos.y() || alwaysOvershoot) ? newPos.y() - newClampedPos.y() : 0;
+ qreal newOvershootX = (canOvershootX) ? newPos.x() - newClampedPos.x() : 0;
+ qreal newOvershootY = (canOvershootY) ? newPos.y() - newClampedPos.y() : 0;
// --- sanity check for scrollTo in case we can't even scroll that direction
if (!(maxPos.x() || alwaysOvershoot))