onRotateMouseDown = function(sender, args){ this.isRotating = true; sender.captureMouse();
this.lastXPosition = args.getPosition(sender).x - (sender.width/2);
this.lastYPosition = args.getPosition(sender).y - (sender.height/2);
this.angle = sender.renderTransform.angle;
}
onRotateMouseMove = function(sender, args){ if(this.isRotating){ var x = (args.getPosition(sender).x - (sender.width/2)); var y = (args.getPosition(sender).y - (sender.height/2)); var theta = Math.atan2(y, x) - Math.atan2(this.lastYPosition, this.lastXPosition); var angleInDegrees = Math.round(theta*180/Math.PI); sender.renderTransform.angle = this.angle + angleInDegrees; }
}
onRotateMouseUp = function(sender){ this.isRotating = false; sender.releaseMouseCapture(); }