(check if) Mouse in cycle? (coordinate Js canvas)


(check if) Mouse in cycle? (coordinate Js canvas)



So, I want to check, if the mouse is (clicked) inside of a ring.



Here it (the ring) is :




<canvas id="textur" width="1584" height="750"></canvas>


<script>
var textur = document.getElementById('textur');
var canvas = textur.getContext('2d');//Dimension


zähler = 0;
diff = ((1)*Math.PI*2*10).toFixed(2)
canvas.lineWidth = 95 ;
canvas.fillStyle = '#09F'
canvas.strokeStyle = '#09F'
canvas.textAlign = 'center'
canvas.beginPath();
canvas.arc(150, 100, 5, 4.72, diff / 10 + 4.72, false)
canvas.stroke();


</script>



So, I know how to do it with a rectangle,but with a ring...



I´m happy about every (useful) answer!





Possible duplicate of Detect if user clicks inside a circle
– AndroidNoobie
Jul 1 at 9:08









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

PySpark - SparkContext: Error initializing SparkContext File does not exist

django NoReverseMatch Exception

Python Tkinter Error, “Too Early to Create Image”