diff options
author | Jan Arve Saether <jan-arve.saether@qt.io> | 2016-10-18 11:49:13 +0200 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2016-11-20 21:09:33 +0000 |
commit | 542eda976c2767ed6c1eecb4dbcbf838e0ca5a19 (patch) | |
tree | 1128e69b70be26e13f35a2591c297d43c6414592 /tests/manual | |
parent | 0beb79fb0e9ed814b3e9447ccd97a0c099af9e4b (diff) |
Fixed some problems with the centroid in PinchHandler
The centroid was not always mapped to the correct coordinate system
In addition, the return value of startingCentroid() was not always
desirable, because its implementation calls sceneGrabPos(). We therefore
had to get the starting centroid by querying touchPointCentroid() whenever
the handler became active.
Change-Id: I69de6b832b9bda208fda4eb90a8a95cc975405c2
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'tests/manual')
-rw-r--r-- | tests/manual/pointer/pinchHandler.qml | 96 |
1 files changed, 52 insertions, 44 deletions
diff --git a/tests/manual/pointer/pinchHandler.qml b/tests/manual/pointer/pinchHandler.qml index d163343a3e..3ab196a10a 100644 --- a/tests/manual/pointer/pinchHandler.qml +++ b/tests/manual/pointer/pinchHandler.qml @@ -42,60 +42,68 @@ import QtQuick 2.8 import Qt.labs.handlers 1.0 Rectangle { - id: root width: 1024; height: 600 - color: "black" - + color: "#eee" Rectangle { - width: 400 - height: 300 - color: "lightsteelblue" - antialiasing: true + id: root + color: "black" + width: 900 + height: 600 + x: 100 - Text { - anchors.centerIn: parent - text: "Pinch with 2 fingers to scale, rotate and translate" - + "\ncurrent rotation: " + pinch2.rotation.toFixed(1) - + "\nscale: " + pinch2.scale.toFixed(1) - + "\ntranslation: " + pinch2.translation - } + Rectangle { + width: 400 + height: 300 + color: "lightsteelblue" + antialiasing: true - PinchHandler { - id: pinch2 - objectName: "2-finger pinch" - minimumRotation: -45 - maximumRotation: 45 - minimumScale: 0.5 - maximumScale: 3 - minimumX: 0 - maximumX: 600 - pointDistanceThreshold: 150 + Text { + anchors.centerIn: parent + text: "Pinch with 2 fingers to scale, rotate and translate" + + "\ncurrent rotation: " + pinch2.rotation.toFixed(1) + + "\nscale: " + pinch2.scale.toFixed(1) + + "\ntranslation: " + pinch2.translation + } + + PinchHandler { + id: pinch2 + objectName: "2-finger pinch" + minimumRotation: -45 + maximumRotation: 45 + minimumScale: 0.5 + maximumScale: 3 + minimumX: 0 + maximumX: 600 + pointDistanceThreshold: 150 + } } - } - Rectangle { - x: 512 - width: 400 - height: 300 - color: "wheat" - antialiasing: true + Rectangle { + x: 500 + width: 400 + height: 300 + color: "wheat" + antialiasing: true - Text { - anchors.centerIn: parent - text: "Pinch with 3 fingers to scale, rotate and translate\nDrag with 1 finger" - + "\ncurrent rotation " + pinch3.rotation.toFixed(1) - } - DragHandler { objectName: "DragHandler" } + Text { + anchors.centerIn: parent + text: "Pinch with 3 fingers to scale, rotate and translate\nDrag with 1 finger" + + "\ncurrent rotation " + pinch3.rotation.toFixed(1) + + "\nscale: " + pinch3.scale.toFixed(1) + + "\ntranslation: " + pinch3.translation + } + DragHandler { objectName: "DragHandler" } - PinchHandler { - id: pinch3 - objectName: "3-finger pinch" - requiredPointCount: 3 - minimumScale: 0.1 - maximumScale: 10 + PinchHandler { + id: pinch3 + objectName: "3-finger pinch" + requiredPointCount: 3 + minimumScale: 0.1 + maximumScale: 10 + } } - } + } Rectangle { id: centroidIndicator property QtObject pincher: pinch2.active ? pinch2 : pinch3 |