summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRalf Engels <ralf.engels@nokia.com>2010-04-14 18:49:02 +0200
committerRalf Engels <ralf.engels@nokia.com>2010-04-14 18:49:02 +0200
commite33254315fab5fa67c53e2c860d41fe751c5a4ff (patch)
treefe9a665064b9651aaa256c3d8c3068f61bf9c9c9
parente36ef61f1a848508e13bf20ca3a17f7fe7b34b23 (diff)
Fix bugs
-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))