@@ -22,6 +22,7 @@ Item {
22 property bool moving: false
22 property bool moving: false
23 property var dragEvents: []
23 property var dragEvents: []
24 property real dragVelocity: 0
24 property real dragVelocity: 0
25+ property int threshold: units.gu(2)
26 // Can be replaced with a fake implementation during tests
27 // Can be replaced with a fake implementation during tests
27 // property var __getCurrentTimeMs: function () { return new Date().getTime() }
28 // property var __getCurrentTimeMs: function () { return new Date().getTime() }
@@ -80,14 +81,13 @@ Item {
80 anchors.fill: parent
81 anchors.fill: parent
81 mouseEnabled: false
82 mouseEnabled: false
82 maximumTouchPoints: 1
83 maximumTouchPoints: 1
84+ property int offset: 0
84− onGestureStarted: {
86+ touchPoints: [
85− if (!d.moving) {
87+ TouchPoint {
86− d.moving = true
88+ id: tp
92 onCanceled: {
92 onCanceled: {
93 d.moving = false
93 d.moving = false
@@ -95,14 +95,19 @@ Item {
97 onTouchUpdated: {
97 onTouchUpdated: {
98− if (touchPoints.length == 0 || !d.moving) {
98+ if (!d.moving) {
99+ if (Math.abs(tp.startY - tp.y) > d.threshold) {
102+ offset = tp.y - tp.startY;
102− var touchPoint = touchPoints[0];
103− d.distance = touchPoint.y - touchPoint.startY
108+ d.distance = tp.y - tp.startY - offset
104− d.pushDragEvent(touchPoint);
109+ d.pushDragEvent(tp);
105− print("pushed event", touchPoint.y, "velocity is now", d.dragVelocity)
110+ print("pushed event", tp.y, "velocity is now", d.dragVelocity)
108 onReleased: {
113 onReleased: {