this is what I found on the Internet, centerx mouse click to get clientx,endx mouse movement to get e.clientx,
360 Math.atan2 (diff_y, diff_x) z this 360 is using 360 degrees, I really don"t understand
var diff_x = endx - centerx, //
diff_y = endy - centery //
var c = 360 * Math.atan2(diff_y, diff_x) / (2 * Math.PI)
360+c
c = c <= -90 ? (360 + c) : c
return c + 90