Mercurial > hg > easyhg
comparison 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 |
comparison
equal
deleted
inserted
replaced
402:75003687f364 | 403:44cef6368690 |
---|---|
52 | 52 |
53 protected: | 53 protected: |
54 QRectF m_pannedRect; | 54 QRectF m_pannedRect; |
55 | 55 |
56 QPoint m_lastDragPos; | 56 QPoint m_lastDragPos; |
57 QPoint m_lastDragStart; | |
57 QPoint m_lastOrigin; | 58 QPoint m_lastOrigin; |
58 QPointF m_velocity; | 59 QPointF m_velocity; |
59 bool m_dragging; | 60 bool m_dragging; |
60 int m_dragTimerMs; | 61 int m_dragTimerMs; |
61 QTimer *m_dragTimer; | 62 QTimer *m_dragTimer; |
63 | |
64 enum DragDirection { | |
65 UnknownDrag, | |
66 HorizontalDrag, | |
67 VerticalDrag, | |
68 FreeDrag | |
69 }; | |
70 DragDirection m_dragDirection; | |
71 void updateDragDirection(QPoint); | |
62 | 72 |
63 virtual void mousePressEvent(QMouseEvent *); | 73 virtual void mousePressEvent(QMouseEvent *); |
64 virtual void mouseMoveEvent(QMouseEvent *); | 74 virtual void mouseMoveEvent(QMouseEvent *); |
65 virtual void mouseReleaseEvent(QMouseEvent *); | 75 virtual void mouseReleaseEvent(QMouseEvent *); |
66 | 76 |