From: Mohammed Sameer Date: Sun, 21 Jul 2013 19:34:56 +0000 (+0300) Subject: lock the UI when user starts to drag the reticle. X-Git-Url: http://cgit.sxemacs.org/?p=harmattan%2Fcameraplus;a=commitdiff_plain;h=8828a801c6a29497e298ef0587424bef10beeaa0 lock the UI when user starts to drag the reticle. --- diff --git a/qml/CameraView.qml b/qml/CameraView.qml index 48b2855..8ce012e 100644 --- a/qml/CameraView.qml +++ b/qml/CameraView.qml @@ -28,7 +28,7 @@ import CameraPlus 1.0 Camera { id: cam - property bool pressed: loader.item ? loader.item.pressed : false + property bool pressed: focusReticle.locked || (loader.item ? loader.item.pressed : false) property int policyMode: loader.item ? loader.item.policyMode : CameraResources.None renderingEnabled: mainView.currentItem == cam diff --git a/qml/FocusReticle.qml b/qml/FocusReticle.qml index 40fa7c1..82d267b 100644 --- a/qml/FocusReticle.qml +++ b/qml/FocusReticle.qml @@ -38,6 +38,8 @@ MouseArea { drag.maximumX: width - reticle.width drag.maximumY: height - reticle.height + property bool locked: false + property int cafStatus: AutoFocus.None property int status: AutoFocus.None property Camera cam @@ -56,13 +58,28 @@ MouseArea { property variant __initialPos onPressed: { + + if (mouse.x >= reticle.x && + mouse.y >= reticle.y && + mouse.x <= reticle.x + reticle.width && + mouse.y <= reticle.y + reticle.height) { + locked = true + } + __initialPos = touchPoint calculateTouchPoint(mouse.x, mouse.y) } - onReleased: calculateTouchPoint(mouse.x, mouse.y) + onReleased: { + calculateTouchPoint(mouse.x, mouse.y) + locked = false + } + onPositionChanged: calculateTouchPoint(mouse.x, mouse.y) - onCanceled: calculateTouchPoint(__initialPos.x, __initialPos.y) + onCanceled: { + calculateTouchPoint(__initialPos.x, __initialPos.y) + locked = false + } function resetReticle() { calculateTouchPoint(centerRect.x, centerRect.y)