summaryrefslogtreecommitdiffstats
path: root/src/declarative/fx
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2009-07-01 05:47:19 (GMT)
committerMartin Jones <martin.jones@nokia.com>2009-07-01 05:47:19 (GMT)
commit9fdcef95dfb369ef490d5be8e4621485d11cddda (patch)
tree3340cbfeb6d21609d8ad7ecf5fc7a75849071906 /src/declarative/fx
parent59a3b7d39e75884027decdd8a029062f0fdde32a (diff)
downloadQt-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.cpp8
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