(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 ...