From 9fdcef95dfb369ef490d5be8e4621485d11cddda Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Wed, 1 Jul 2009 15:47:19 +1000 Subject: Implement edge resistance for flickable dragging horizontally. --- src/declarative/fx/qfxflickable.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/declarative/fx/qfxflickable.cpp b/src/declarative/fx/qfxflickable.cpp index 3580edb..a82385a 100644 --- a/src/declarative/fx/qfxflickable.cpp +++ b/src/declarative/fx/qfxflickable.cpp @@ -597,7 +597,13 @@ void QFxFlickablePrivate::handleMouseMoveEvent(QGraphicsSceneMouseEvent *event) int dx = int(event->pos().x() - pressPos.x()); if (qAbs(dx) > FlickThreshold || pressTime.elapsed() > 200) { qreal newX = dx + pressX; - if (q->overShoot() || (newX <= q->minXExtent() && newX >= q->maxXExtent())) { + const qreal minX = q->minXExtent(); + const qreal maxX = q->maxXExtent(); + if (newX > minX) + newX = minX + (newX - minX) / 2; + if (newX < maxX && maxX - minX < 0) + newX = maxX + (newX - maxX) / 2; + if (q->overShoot() || (newX <= minX && newX >= maxX)) { if (dragMode == QFxFlickable::Hard) _moveX.setValue(newX); else -- cgit v0.12