diff options
author | Martin Jones <martin.jones@nokia.com> | 2009-07-01 05:47:19 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2009-07-01 05:47:19 (GMT) |
commit | 9fdcef95dfb369ef490d5be8e4621485d11cddda (patch) | |
tree | 3340cbfeb6d21609d8ad7ecf5fc7a75849071906 /src/declarative/fx | |
parent | 59a3b7d39e75884027decdd8a029062f0fdde32a (diff) | |
download | Qt-9fdcef95dfb369ef490d5be8e4621485d11cddda.zip Qt-9fdcef95dfb369ef490d5be8e4621485d11cddda.tar.gz Qt-9fdcef95dfb369ef490d5be8e4621485d11cddda.tar.bz2 |
Implement edge resistance for flickable dragging horizontally.
Diffstat (limited to 'src/declarative/fx')
-rw-r--r-- | src/declarative/fx/qfxflickable.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
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 |