summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2011-03-07 05:32:07 (GMT)
committerJoona Petrell <joona.t.petrell@nokia.com>2011-03-08 00:12:07 (GMT)
commit02cde1e6d991d10acd96492d5c5757cf6717ec98 (patch)
treec43dcbab1dbf41c9876fe784380337369605ae2e /examples
parentcc6408ccd5453d1bed9f98b9caa14861cea5742b (diff)
downloadQt-02cde1e6d991d10acd96492d5c5757cf6717ec98.zip
Qt-02cde1e6d991d10acd96492d5c5757cf6717ec98.tar.gz
Qt-02cde1e6d991d10acd96492d5c5757cf6717ec98.tar.bz2
PinchArea example produced incorrect scaling.
The maths was dodgy - producing far greater scaling than that provided by PinchArea. Change-Id: I4a1ee1b0d65eed623ec9ee92c22c9740116430c5 Task-number: QTBUG-17828 Reviewed-by: Michael Brasser
Diffstat (limited to 'examples')
-rw-r--r--examples/declarative/touchinteraction/pincharea/flickresize.qml11
1 files changed, 9 insertions, 2 deletions
diff --git a/examples/declarative/touchinteraction/pincharea/flickresize.qml b/examples/declarative/touchinteraction/pincharea/flickresize.qml
index a2f81ff..9439ace 100644
--- a/examples/declarative/touchinteraction/pincharea/flickresize.qml
+++ b/examples/declarative/touchinteraction/pincharea/flickresize.qml
@@ -54,14 +54,21 @@ Rectangle {
PinchArea {
width: Math.max(flick.contentWidth, flick.width)
height: Math.max(flick.contentHeight, flick.height)
+
+ property real initialWidth
+ property real initialHeight
+ onPinchStarted: {
+ initialWidth = flick.contentWidth
+ initialHeight = flick.contentHeight
+ }
+
onPinchUpdated: {
// adjust content pos due to drag
flick.contentX += pinch.previousCenter.x - pinch.center.x
flick.contentY += pinch.previousCenter.y - pinch.center.y
// resize content
- var scale = 1.0 + pinch.scale - pinch.previousScale
- flick.resizeContent(flick.contentWidth * scale, flick.contentHeight * scale, pinch.center)
+ flick.resizeContent(initialWidth * pinch.scale, initialHeight * pinch.scale, pinch.center)
}
onPinchFinished: {