ActionButton.qml: centre-align the clickable part of the button

buttonGraphics.x refers to the centre of the action button. For the click to
be within the central area of the button, mouse.x needs to be between:
        buttonGraphics.x - buttonGraphics.width / 2, and
        buttonGraphics.x + buttonGraphics.width / 2

Signed-off-by: Rick Walsh <rickmwa...@gmail.com>
From 11d116fc0fa3945b7158da2bdd08bafb8009b0a1 Mon Sep 17 00:00:00 2001
From: Rick Walsh <rickmwa...@gmail.com>
Date: Sat, 6 Feb 2016 09:53:53 +1100
Subject: [PATCH] ActionButton.qml: centre-align the clickable part of the
 button

buttonGraphics.x refers to the centre of the action button. For the click to
be within the central area of the button, mouse.x needs to be between:
	buttonGraphics.x - buttonGraphics.width / 2, and
	buttonGraphics.x + buttonGraphics.width / 2

Signed-off-by: Rick Walsh <rickmwa...@gmail.com>
---
 components/mobilecomponents/qml/private/ActionButton.qml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/components/mobilecomponents/qml/private/ActionButton.qml b/components/mobilecomponents/qml/private/ActionButton.qml
index 3cdd13d..f65a3ed 100644
--- a/components/mobilecomponents/qml/private/ActionButton.qml
+++ b/components/mobilecomponents/qml/private/ActionButton.qml
@@ -84,7 +84,7 @@ MouseArea {
         }
     }
     onClicked: {
-        if (mouse.x < buttonGraphics.x || mouse.x > buttonGraphics.x + buttonGraphics.width) {
+        if (mouse.x < buttonGraphics.x - buttonGraphics.width / 2 || mouse.x > buttonGraphics.x + buttonGraphics.width / 2) {
             return;
         }
         if (checkable) {
-- 
2.5.0

_______________________________________________
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to