From ae2471d2acbc3d43e62e599bd71dd9a2ee41062a Mon Sep 17 00:00:00 2001 From: Pavel fljot Date: Sat, 14 Dec 2013 11:09:08 +0200 Subject: [PATCH] Fix RotateGesture bug where rotation was almost double negative Pi. Thanks to @psyone for report here http://forum.starling-framework.org/topic/displayobject-rotation-to-degree --- src/org/gestouch/gestures/RotateGesture.as | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/org/gestouch/gestures/RotateGesture.as b/src/org/gestouch/gestures/RotateGesture.as index 5d99900..e53eb19 100644 --- a/src/org/gestouch/gestures/RotateGesture.as +++ b/src/org/gestouch/gestures/RotateGesture.as @@ -87,7 +87,9 @@ package org.gestouch.gestures return; var currTransformVector:Point = _touch2.location.subtract(_touch1.location); - var rotation:Number = Math.atan2(currTransformVector.y, currTransformVector.x) - Math.atan2(_transformVector.y, _transformVector.x); + var cross:Number = (_transformVector.x * currTransformVector.y) - (currTransformVector.x * _transformVector.y); + var dot:Number = (_transformVector.x * currTransformVector.x) + (_transformVector.y * currTransformVector.y); + var rotation:Number = Math.atan2(cross, dot); if (state == GestureState.POSSIBLE) {