Reset touch focus back if the user starts dragging the view (onCanceled)
authorMohammed Sameer <msameer@foolab.org>
Sun, 21 Jul 2013 05:03:49 +0000 (08:03 +0300)
committerMohammed Sameer <msameer@foolab.org>
Sun, 21 Jul 2013 05:03:49 +0000 (08:03 +0300)
qml/FocusReticle.qml

index dd22a7e..40fa7c1 100644 (file)
@@ -54,9 +54,15 @@ MouseArea {
     property variant allRoiRects
     property bool roiMode: allRoiRects != null && allRoiRects.length > 0 && !touchMode && !pressed
 
-    onPressed: calculateTouchPoint(mouse.x, mouse.y)
+    property variant __initialPos
+    onPressed: {
+        __initialPos = touchPoint
+        calculateTouchPoint(mouse.x, mouse.y)
+    }
+
     onReleased: calculateTouchPoint(mouse.x, mouse.y)
     onPositionChanged: calculateTouchPoint(mouse.x, mouse.y)
+    onCanceled: calculateTouchPoint(__initialPos.x, __initialPos.y)
 
     function resetReticle() {
         calculateTouchPoint(centerRect.x, centerRect.y)