aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/handlers/qquickpinchhandler_p.h
diff options
context:
space:
mode:
authorJan Arve Saether <jan-arve.saether@qt.io>2016-12-13 11:38:23 +0100
committerShawn Rutledge <shawn.rutledge@qt.io>2016-12-27 11:54:46 +0000
commit3eeffae835b3474c8a3ca62125cb8ec24acdaa84 (patch)
tree9dc883768516931acb4f17d93b09bd09087c52a2 /src/quick/handlers/qquickpinchhandler_p.h
parent4f69895cf15b9ff76b9a4404709a28153d34de5e (diff)
Let pinchhandler operate on QQuickItem properties
This requires coordinate system mapping that varies with the transformOrigin. The properties exposed from PinchHandler (rotation, scale and translation) are currently relative to the point when the pinch became active. (Therefore, rotation, will reset back to 0 when a new pinch is activated). Its still unclear how the properties that limits the transform should influence. With this patch, they are like this: * {min,max}imumRotation applies to the actual rotation of the item. * {min,max}imumScale applies to the actual scale of the item. * {min,max}imum{X,Y} applies to the actual position of the item. (This has some unfortunate side-effects when the item is scaled or rotated, since the items actual position will change as it rotates) In addition, the behavior described above means that the limits won't have any effect if there is no target item. Change-Id: I279fb03667cd75324e8337039ae2594658265d13 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'src/quick/handlers/qquickpinchhandler_p.h')
-rw-r--r--src/quick/handlers/qquickpinchhandler_p.h15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/quick/handlers/qquickpinchhandler_p.h b/src/quick/handlers/qquickpinchhandler_p.h
index 83d6447b15..0861368682 100644
--- a/src/quick/handlers/qquickpinchhandler_p.h
+++ b/src/quick/handlers/qquickpinchhandler_p.h
@@ -99,9 +99,9 @@ public:
PinchOrigin pinchOrigin() const { return m_pinchOrigin; }
void setPinchOrigin(PinchOrigin pinchOrigin);
- QPointF translation() const { return m_translation; }
- qreal scale() const { return m_scale; }
- qreal rotation() const { return m_rotation; }
+ QPointF translation() const { return m_activeTranslation; }
+ qreal scale() const { return m_activeScale; }
+ qreal rotation() const { return m_activeRotation; }
QPointF centroid() const { return m_centroid; }
qreal minimumX() const { return m_minimumX; }
@@ -128,14 +128,13 @@ signals:
protected:
void onActiveChanged() override;
- void onTargetChanged();
void handlePointerEventImpl(QQuickPointerEvent *event) override;
private:
// properties
- qreal m_scale;
- qreal m_rotation;
- QPointF m_translation;
+ qreal m_activeScale;
+ qreal m_activeRotation;
+ QPointF m_activeTranslation;
QPointF m_centroid;
qreal m_minimumScale;
@@ -154,9 +153,9 @@ private:
// internal
qreal m_startScale;
qreal m_startRotation;
- qreal m_activeRotation;
QPointF m_startCentroid;
qreal m_startDistance;
+ QPointF m_startPos;
QVector<PointData> m_startAngles;
QMatrix4x4 m_startMatrix;