From b214f0da048a71cd7da410c32c111d3b92cbca47 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Tue, 27 Oct 2009 13:07:33 +1000 Subject: Fix dragging at the end of a flickable with overShoot: false --- src/declarative/fx/qfxflickable.cpp | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/src/declarative/fx/qfxflickable.cpp b/src/declarative/fx/qfxflickable.cpp index a83ee66..cbfe9f6 100644 --- a/src/declarative/fx/qfxflickable.cpp +++ b/src/declarative/fx/qfxflickable.cpp @@ -618,11 +618,18 @@ void QFxFlickablePrivate::handleMouseMoveEvent(QGraphicsSceneMouseEvent *event) newY = minY + (newY - minY) / 2; if (newY < maxY && maxY - minY < 0) newY = maxY + (newY - maxY) / 2; - if (q->overShoot() || (newY <= minY && newY >= maxY)) { + if (!q->overShoot() && (newY > minY || newY < maxY)) { + if (newY > minY) + newY = minY; + else if (newY < maxY) + newY = maxY; + else + rejectY = true; + } + if (!rejectY) { _moveY.setValue(newY); moved = true; - } else if (!q->overShoot()) - rejectY = true; + } if (qAbs(dy) > DragThreshold) stealMouse = true; } @@ -638,11 +645,19 @@ void QFxFlickablePrivate::handleMouseMoveEvent(QGraphicsSceneMouseEvent *event) newX = minX + (newX - minX) / 2; if (newX < maxX && maxX - minX < 0) newX = maxX + (newX - maxX) / 2; - if (q->overShoot() || (newX <= minX && newX >= maxX)) { + if (!q->overShoot() && (newX > minX || newX < maxX)) { + if (newX > minX) + newX = minX; + else if (newX < maxX) + newX = maxX; + else + rejectX = true; + } + if (!rejectX) { _moveX.setValue(newX); moved = true; - } else if (!q->overShoot()) - rejectX = true; + } + if (qAbs(dx) > DragThreshold) stealMouse = true; } -- cgit v0.12