diff options
author | Martin Jones <martin.jones@nokia.com> | 2009-11-24 07:23:28 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2009-11-24 07:23:28 (GMT) |
commit | c711113555a815db293c7e0de9cfae9a9a07c681 (patch) | |
tree | be88ea348587cdb72752252b2a28c53ad93829f2 /src/declarative | |
parent | fe996d89f4441d9c3ee341083a2bf133a6a57114 (diff) | |
download | Qt-c711113555a815db293c7e0de9cfae9a9a07c681.zip Qt-c711113555a815db293c7e0de9cfae9a9a07c681.tar.gz Qt-c711113555a815db293c7e0de9cfae9a9a07c681.tar.bz2 |
Fix GridView drag beyond end resistance.
Diffstat (limited to 'src/declarative')
-rw-r--r-- | src/declarative/graphicsitems/qmlgraphicsflickable.cpp | 4 | ||||
-rw-r--r-- | src/declarative/graphicsitems/qmlgraphicsgridview.cpp | 12 |
2 files changed, 12 insertions, 4 deletions
diff --git a/src/declarative/graphicsitems/qmlgraphicsflickable.cpp b/src/declarative/graphicsitems/qmlgraphicsflickable.cpp index b3a34ed..cc0f905 100644 --- a/src/declarative/graphicsitems/qmlgraphicsflickable.cpp +++ b/src/declarative/graphicsitems/qmlgraphicsflickable.cpp @@ -613,7 +613,7 @@ void QmlGraphicsFlickablePrivate::handleMouseMoveEvent(QGraphicsSceneMouseEvent const qreal maxY = q->maxYExtent(); if (newY > minY) newY = minY + (newY - minY) / 2; - if (newY < maxY && maxY - minY < 0) + if (newY < maxY && maxY - minY <= 0) newY = maxY + (newY - maxY) / 2; if (!q->overShoot() && (newY > minY || newY < maxY)) { if (newY > minY) @@ -640,7 +640,7 @@ void QmlGraphicsFlickablePrivate::handleMouseMoveEvent(QGraphicsSceneMouseEvent const qreal maxX = q->maxXExtent(); if (newX > minX) newX = minX + (newX - minX) / 2; - if (newX < maxX && maxX - minX < 0) + if (newX < maxX && maxX - minX <= 0) newX = maxX + (newX - maxX) / 2; if (!q->overShoot() && (newX > minX || newX < maxX)) { if (newX > minX) diff --git a/src/declarative/graphicsitems/qmlgraphicsgridview.cpp b/src/declarative/graphicsitems/qmlgraphicsgridview.cpp index 7e2d983..e36ea50 100644 --- a/src/declarative/graphicsitems/qmlgraphicsgridview.cpp +++ b/src/declarative/graphicsitems/qmlgraphicsgridview.cpp @@ -1138,7 +1138,11 @@ qreal QmlGraphicsGridView::maxYExtent() const Q_D(const QmlGraphicsGridView); if (d->flow == QmlGraphicsGridView::TopToBottom) return QmlGraphicsFlickable::maxYExtent(); - return -(d->endPosition() - height()); + qreal extent = -(d->endPosition() - height()); + const qreal minY = minYExtent(); + if (extent > minY) + extent = minY; + return extent; } qreal QmlGraphicsGridView::minXExtent() const @@ -1154,7 +1158,11 @@ qreal QmlGraphicsGridView::maxXExtent() const Q_D(const QmlGraphicsGridView); if (d->flow == QmlGraphicsGridView::LeftToRight) return QmlGraphicsFlickable::maxXExtent(); - return -(d->endPosition() - width()); + qreal extent = -(d->endPosition() - width()); + const qreal minX = minXExtent(); + if (extent > minX) + extent = minX; + return extent; } void QmlGraphicsGridView::keyPressEvent(QKeyEvent *event) |