@@ -32,17 +32,21 @@ Item {
34 function update() {
34 function update() {
35+ var previouslyStopped = stopLateralChanges;
35 calc.trackedPosition = trackedValue;
37 calc.trackedPosition = trackedValue;
36 stopLateralChanges = Math.abs(calc.calculate()) > velocityThreshold;
38 stopLateralChanges = Math.abs(calc.calculate()) > velocityThreshold;
39− onTrackedValueChanged: {
40− update(); // initial calculation
41− if (root.stopLateralChanges) { // only start timer if we're above the threshold.
40+ if (stopLateralChanges) { // only start timer if we're above the threshold.
42 velocityTimer.start();
41 velocityTimer.start();
42+ } else if (previouslyStopped) { // if we have previously been stopped, then trigger the signal
43+ velocityTimer.stop();
44+ velocityThresholdTriggered();
48+ onTrackedValueChanged: update();
46 AxisVelocityCalculator {
50 AxisVelocityCalculator {
@@ -50,13 +54,6 @@ Item {
51 id: velocityTimer
55 id: velocityTimer
52 interval: 50
56 interval: 50
53− onTriggered: {
57+ onTriggered: update();
55− if (root.stopLateralChanges) {
56− velocityTimer.start();
58− velocityThresholdTriggered();