diff src/panned.h @ 403:44cef6368690

Ensure drags are constrained to either horizontal or vertical once the user's primary direction has become clear, switching to free drag only if the user makes a big move in the other axis
author Chris Cannam
date Wed, 25 May 2011 16:16:01 +0100
parents b9c153e00e84
children 533519ebc0cb
line wrap: on
line diff
--- a/src/panned.h	Wed May 25 16:05:40 2011 +0100
+++ b/src/panned.h	Wed May 25 16:16:01 2011 +0100
@@ -54,12 +54,22 @@
     QRectF m_pannedRect;
 
     QPoint m_lastDragPos;
+    QPoint m_lastDragStart;
     QPoint m_lastOrigin;
     QPointF m_velocity;
     bool m_dragging;
     int m_dragTimerMs;
     QTimer *m_dragTimer;
 
+    enum DragDirection {
+        UnknownDrag,
+        HorizontalDrag,
+        VerticalDrag,
+        FreeDrag
+    };
+    DragDirection m_dragDirection;
+    void updateDragDirection(QPoint);
+
     virtual void mousePressEvent(QMouseEvent *);
     virtual void mouseMoveEvent(QMouseEvent *);
     virtual void mouseReleaseEvent(QMouseEvent *);