diff options
author | Martin Jones <martin.jones@nokia.com> | 2010-08-03 05:43:48 (GMT) |
---|---|---|
committer | Toby Tomkins <toby.tomkins@nokia.com> | 2010-08-04 03:49:17 (GMT) |
commit | f4b435f8164e344242cb56312ee51059064ed63e (patch) | |
tree | 57ea9c78a36a70f6d97d8b5a2e24a6131d8e11a2 | |
parent | f564897bb3ef1b444b7ad8cdc45277d4f91114cf (diff) | |
download | Qt-f4b435f8164e344242cb56312ee51059064ed63e.zip Qt-f4b435f8164e344242cb56312ee51059064ed63e.tar.gz Qt-f4b435f8164e344242cb56312ee51059064ed63e.tar.bz2 |
Fix Flickable.StopAtBounds behavior when content size < flickable size
Clip the content position to the beginning rather than the end, if
both apply.
Task-number: QTBUG-12573
Reviewed-by: Michael Brasser
(cherry picked from commit a0b531163a79c9097185b580fdf4aa8157cead41)
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativeflickable.cpp | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativeflickable.cpp b/src/declarative/graphicsitems/qdeclarativeflickable.cpp index 998b33a..19cabdd 100644 --- a/src/declarative/graphicsitems/qdeclarativeflickable.cpp +++ b/src/declarative/graphicsitems/qdeclarativeflickable.cpp @@ -681,12 +681,15 @@ void QDeclarativeFlickablePrivate::handleMouseMoveEvent(QGraphicsSceneMouseEvent if (newY < maxY && maxY - minY <= 0) newY = maxY + (newY - maxY) / 2; if (boundsBehavior == QDeclarativeFlickable::StopAtBounds && (newY > minY || newY < maxY)) { - if (newY > minY) - newY = minY; - else if (newY < maxY) + rejectY = true; + if (newY < maxY) { newY = maxY; - else - rejectY = true; + rejectY = false; + } + if (newY > minY) { + newY = minY; + rejectY = false; + } } if (!rejectY && stealMouse) { vData.move.setValue(qRound(newY)); @@ -708,12 +711,15 @@ void QDeclarativeFlickablePrivate::handleMouseMoveEvent(QGraphicsSceneMouseEvent if (newX < maxX && maxX - minX <= 0) newX = maxX + (newX - maxX) / 2; if (boundsBehavior == QDeclarativeFlickable::StopAtBounds && (newX > minX || newX < maxX)) { - if (newX > minX) - newX = minX; - else if (newX < maxX) + rejectX = true; + if (newX < maxX) { newX = maxX; - else - rejectX = true; + rejectX = false; + } + if (newX > minX) { + newX = minX; + rejectX = false; + } } if (!rejectX && stealMouse) { hData.move.setValue(qRound(newX)); |