//>>built
define("demos/touch/rotate",["dojo/_base/kernel","dojox/gesture/Base","dojo/_base/declare"],function(_1,_2){var _3=_1.declare(_2,{defaultEvent:"rotate",subEvents:["end"],press:function(_4,e){if(e.touches&&e.touches.length==2){_4.rotateStart=true;_4.rotation=0;_4.point1={x:e.touches[0].clientX,y:e.touches[0].clientY};_4.point2={x:e.touches[1].clientX,y:e.touches[1].clientY};}},move:function(_5,e){if(e.touches&&e.touches.length==2){var _6={x:e.touches[0].clientX,y:e.touches[0].clientY};var _7={x:e.touches[1].clientX,y:e.touches[1].clientY};if(e.rotation){_5.rotation=e.rotation;}else{var _8=0;v1={x:_6.x-_7.x,y:_6.y-_7.y};v2={x:_5.point1.x-_5.point2.x,y:_5.point1.y-_5.point2.y};cos=(v1.x*v2.x+v1.y*v2.y)/(Math.sqrt(Math.pow(v1.x,2)+Math.pow(v1.y,2))*Math.sqrt(Math.pow(v2.x,2)+Math.pow(v2.y,2)));if(cos>1){cos=1;}if(cos<-1){cos=-1;}_8=(Math.acos(cos)*180)/Math.PI;if((v1.y*v2.x-v1.x*v2.y)>0){_5.rotation+=_8;}else{_5.rotation-=_8;}}_5.point1=_6;_5.point2=_7;e.rotation=_5.rotation;this.fire(e.target,{type:"rotate",rotation:_5.rotation});}},release:function(_9,e){if(_9.rotateStart){if(!e.rotation){e.rotation=_9.rotation;}_9.rotateStart=false;this.fire(e.target,{type:"rotate.end",rotation:_9.rotation});_9.rotation=0;}}});var _a=new _3();var ns=_1.getObject("demos.touch",true);return (ns.rotate=_a);});