From fae076941bf49f13f5911ced9dd00151b4572212 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Thu, 7 Sep 2017 16:09:07 +0200 Subject: FakeFlickable: returnToBounds only on axes which need it MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- tests/manual/pointer/content/FakeFlickable.qml | 55 ++++++++++---------------- 1 file changed, 21 insertions(+), 34 deletions(-) (limited to 'tests') 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 } } } -- cgit v1.2.1