diff options
author | Denis Dzyubenko <denis.dzyubenko@nokia.com> | 2009-11-04 13:37:45 (GMT) |
---|---|---|
committer | Denis Dzyubenko <denis.dzyubenko@nokia.com> | 2009-11-05 11:54:43 (GMT) |
commit | 847be4eadc3bfc92daad728ce9f70e658e380556 (patch) | |
tree | 80c260288d06d4acf988c1c4140d02f1c980ee2e /src/gui/kernel/qstandardgestures.cpp | |
parent | 70c1c87a3df52e510413c3e8512d9e55df00e7bd (diff) | |
download | Qt-847be4eadc3bfc92daad728ce9f70e658e380556.zip Qt-847be4eadc3bfc92daad728ce9f70e658e380556.tar.gz Qt-847be4eadc3bfc92daad728ce9f70e658e380556.tar.bz2 |
Improved pinch gesture.
Made sure we emit the same values for the pinch gesture as on Mac.
Reviewed-by: trustme
Diffstat (limited to 'src/gui/kernel/qstandardgestures.cpp')
-rw-r--r-- | src/gui/kernel/qstandardgestures.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/gui/kernel/qstandardgestures.cpp b/src/gui/kernel/qstandardgestures.cpp index 79346ed..a0055a1 100644 --- a/src/gui/kernel/qstandardgestures.cpp +++ b/src/gui/kernel/qstandardgestures.cpp @@ -216,7 +216,13 @@ QGestureRecognizer::Result QPinchGestureRecognizer::recognize(QGesture *state, d->totalScaleFactor += d->scaleFactor - d->lastScaleFactor; d->changeFlags |= QPinchGesture::ScaleFactorChanged; - const qreal rotationAngle = -line.angle(); + qreal angle = QLineF(p1.screenPos(), p2.screenPos()).angle(); + if (angle > 180) + angle -= 360; + qreal startAngle = QLineF(p1.startScreenPos(), p2.startScreenPos()).angle(); + if (startAngle > 180) + startAngle -= 360; + const qreal rotationAngle = startAngle - angle; if (d->isNewSequence) d->lastRotationAngle = rotationAngle; else |