summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenis Dzyubenko <denis.dzyubenko@nokia.com>2010-08-18 16:31:02 +0200
committerDenis Dzyubenko <denis.dzyubenko@nokia.com>2010-08-18 16:31:02 +0200
commit0c36a9e306f3559eef902d4fe13b5f6e96896b16 (patch)
treef38ee5ce4226da23994b7ed07ab76a75d4e0b3d8
parent9629cbcd20ff8950ed7d904f210e596391b74de1 (diff)
Added pan to the RotatableImage component.
-rw-r--r--multilayer-dashboard/RotatableImage.qml38
1 files changed, 27 insertions, 11 deletions
diff --git a/multilayer-dashboard/RotatableImage.qml b/multilayer-dashboard/RotatableImage.qml
index 5938252..59df4e2 100644
--- a/multilayer-dashboard/RotatableImage.qml
+++ b/multilayer-dashboard/RotatableImage.qml
@@ -42,6 +42,8 @@ import Qt 4.7
import Qt.labs.gestures 1.0
Rectangle {
+ id: me
+
property string source : "images/qt-logo.png"
width: 160
@@ -58,15 +60,13 @@ Rectangle {
}
function pinch(gesture) {
- if (parent.fullScreen) {
- if (gesture.changeFlags & PinchGesture.RotationAngleChanged)
- img.rotation += gesture.rotationAngle - gesture.lastRotationAngle
- if (gesture.changeFlags & PinchGesture.ScaleFactorChanged)
- img.scale *= gesture.scaleFactor
- if (gesture.changeFlags & PinchGesture.CenterPointChanged) {
- img.x += gesture.centerPoint.x - gesture.lastCenterPoint.x
- img.y += gesture.centerPoint.y - gesture.lastCenterPoint.y
- }
+ if (gesture.changeFlags & PinchGesture.RotationAngleChanged)
+ img.rotation += gesture.rotationAngle - gesture.lastRotationAngle
+ if (gesture.changeFlags & PinchGesture.ScaleFactorChanged)
+ img.scale *= gesture.scaleFactor
+ if (gesture.changeFlags & PinchGesture.CenterPointChanged) {
+ img.x += gesture.centerPoint.x - gesture.lastCenterPoint.x
+ img.y += gesture.centerPoint.y - gesture.lastCenterPoint.y
}
}
@@ -74,8 +74,24 @@ Rectangle {
anchors.fill: parent
Pinch {
- onStarted: pinch(gesture)
- onUpdated: pinch(gesture)
+ when: me.parent.fullScreen
+ onUpdated: {
+ if (gesture.changeFlags & PinchGesture.RotationAngleChanged)
+ img.rotation += gesture.rotationAngle - gesture.lastRotationAngle
+ if (gesture.changeFlags & PinchGesture.ScaleFactorChanged)
+ img.scale *= gesture.scaleFactor
+ if (gesture.changeFlags & PinchGesture.CenterPointChanged) {
+ img.x += gesture.centerPoint.x - gesture.lastCenterPoint.x
+ img.y += gesture.centerPoint.y - gesture.lastCenterPoint.y
+ }
+ }
+ }
+ Pan {
+ when: me.parent.fullScreen
+ onUpdated: {
+ img.x += gesture.delta.x
+ img.y += gesture.delta.y
+ }
}
}
}