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
This commit is contained in:
Pavel fljot 2013-12-14 11:09:08 +02:00
parent e4ca10cb91
commit ae2471d2ac

View file

@ -87,7 +87,9 @@ package org.gestouch.gestures
return; return;
var currTransformVector:Point = _touch2.location.subtract(_touch1.location); 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) if (state == GestureState.POSSIBLE)
{ {