Constraining drag movement to points on a circle

view story

http://stackoverflow.com – I have made a custom seekbar based on a circle. By knowing the radius, cursor location and so on I have been able to constrain the draggable thumb part to the circle successfully. You can touch anywhere in or around the circle, the angle is calculated and then the draggable part put on the circumference at the desired distance & angle using sin/cos. Good so far. However, there needs to be 168 selectable values on the seekbar so at the moment I have simply divided 168 by 360 (0.47) and return the value of the current degree times this figure to give a value between 0-168. It's extremel (HowTos)