[calligra] krita/plugins/tools/tool_transform2: [FEATURE] Make the grabbing area for Transform Tool handles twice lager than the handles themselves

Dmitry Kazakov dimula73 at gmail.com
Fri Jun 6 12:50:55 UTC 2014


Git commit 01d1d26fc9dcd0d444442add3b78b4c1c73f677c by Dmitry Kazakov.
Committed on 06/06/2014 at 12:50.
Pushed by dkazakov into branch 'master'.

[FEATURE] Make the grabbing area for Transform Tool handles twice lager than the handles themselves

BUG:334933
CCMAIL:kimageshop at kde.org

M  +6    -4    krita/plugins/tools/tool_transform2/kis_tool_transform.cc
M  +2    -0    krita/plugins/tools/tool_transform2/kis_tool_transform.h

http://commits.kde.org/calligra/01d1d26fc9dcd0d444442add3b78b4c1c73f677c

diff --git a/krita/plugins/tools/tool_transform2/kis_tool_transform.cc b/krita/plugins/tools/tool_transform2/kis_tool_transform.cc
index 9302ee1..b799842 100644
--- a/krita/plugins/tools/tool_transform2/kis_tool_transform.cc
+++ b/krita/plugins/tools/tool_transform2/kis_tool_transform.cc
@@ -109,8 +109,10 @@ KisToolTransform::KisToolTransform(KoCanvasBase * canvas)
     m_imageTooBig = false;
     m_origDevice = 0;
     m_origSelection = 0;
-    m_handleRadius = 12;
-    m_rotationCenterRadius = 12;
+    m_handleVisualRadius = 12; // size for painting on screed
+    m_rotationCenterVisualRadius = 12;
+    m_handleRadius = 2 * m_handleVisualRadius; // the threshold for a mouse drag
+    m_rotationCenterRadius = 2 * m_rotationCenterVisualRadius;
     m_maxRadius = (m_handleRadius > m_rotationCenterRadius) ? m_handleRadius : m_rotationCenterRadius;
 
 
@@ -509,10 +511,10 @@ void KisToolTransform::paint(QPainter& gc, const KoViewConverter &converter)
 
         // Draw Handles
 
-        qreal d = m_handleRadius / scaleFromAffineMatrix(m_handlesTransform);
+        qreal d = m_handleVisualRadius / scaleFromAffineMatrix(m_handlesTransform);
         QRectF handleRect(-0.5 * d, -0.5 * d, d, d);
 
-        qreal r = m_rotationCenterRadius / scaleFromAffineMatrix(m_handlesTransform);
+        qreal r = m_rotationCenterVisualRadius / scaleFromAffineMatrix(m_handlesTransform);
         QRectF rotationCenterRect(-0.5 * r, -0.5 * r, r, r);
 
         QPainterPath handles;
diff --git a/krita/plugins/tools/tool_transform2/kis_tool_transform.h b/krita/plugins/tools/tool_transform2/kis_tool_transform.h
index 4efb67a..250c609 100644
--- a/krita/plugins/tools/tool_transform2/kis_tool_transform.h
+++ b/krita/plugins/tools/tool_transform2/kis_tool_transform.h
@@ -382,6 +382,8 @@ private:
     ToolTransformArgs m_clickArgs;
     int m_handleRadius;
     int m_rotationCenterRadius;
+    int m_handleVisualRadius;
+    int m_rotationCenterVisualRadius;
     int m_maxRadius;
 
     bool m_actuallyMoveWhileSelected; // true <=> selection has been moved while clicked


More information about the kimageshop mailing list