diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2017-09-07 16:09:07 +0200 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2017-09-11 13:59:12 +0000 |
commit | fae076941bf49f13f5911ced9dd00151b4572212 (patch) | |
tree | ca5055a480d59e23054f17fde0a29c5ef8f1f6f7 | |
parent | 9549d1783c5f738dbcb06d11b06ce6cc5a3ee0ea (diff) |
FakeFlickable: returnToBounds only on axes which need it
If you flick in such a way that y is within bounds but x is out of
bounds, then returnToBounds should not change y; and vice-versa.
Change-Id: I156a2f6e28bdcd6aecce35e639acaa05e55ee382
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
-rw-r--r-- | tests/manual/pointer/content/FakeFlickable.qml | 55 |
1 files changed, 21 insertions, 34 deletions
diff --git a/tests/manual/pointer/content/FakeFlickable.qml b/tests/manual/pointer/content/FakeFlickable.qml index 55dafef82e..e8fad99510 100644 --- a/tests/manual/pointer/content/FakeFlickable.qml +++ b/tests/manual/pointer/content/FakeFlickable.qml @@ -62,23 +62,20 @@ Item { property real ylimit: root.height - __contentItem.height function returnToBounds() { - var startAnim = false if (x > 0) { - returnToBoundsAnim.x = 0 - startAnim = true + returnXAnim.to = 0 + returnXAnim.start() } else if (x < xlimit) { - returnToBoundsAnim.x = xlimit - startAnim = true + returnXAnim.to = xlimit + returnXAnim.start() } if (y > 0) { - returnToBoundsAnim.y = 0 - startAnim = true + returnYAnim.to = 0 + returnYAnim.start() } else if (y < ylimit) { - returnToBoundsAnim.y = ylimit - startAnim = true + returnYAnim.to = ylimit + returnYAnim.start() } - if (startAnim) - returnToBoundsAnim.start() } DragHandler { @@ -94,29 +91,19 @@ Item { root.flickEnded() } } - ParallelAnimation { - id: returnToBoundsAnim - property Item target: __contentItem - property int duration: 200 - property real x: 0 - property real y: 0 - - NumberAnimation { - id: xAnim - target: returnToBoundsAnim.target - property: "x" - to: returnToBoundsAnim.x - duration: returnToBoundsAnim.duration - easing.type: Easing.OutQuad - } - NumberAnimation { - id: yAnim - target: returnToBoundsAnim.target - property: "y" - to: returnToBoundsAnim.y - duration: returnToBoundsAnim.duration - easing.type: Easing.OutQuad - } + NumberAnimation { + id: returnXAnim + target: __contentItem + property: "x" + duration: 200 + easing.type: Easing.OutQuad + } + NumberAnimation { + id: returnYAnim + target: __contentItem + property: "y" + duration: 200 + easing.type: Easing.OutQuad } } } |