How to select lines that are drawn on a HTML5 Canvas?
I am using using HTML5 Canvas to plot lines. A single line is formed by calling drawLine() on multiple intermediate points. For example: (0,0) -> (10, 10) -> (10, 5) -> (20, 12) would show up as one line on the plot. All the (x,y) co-ordinates of a line are stored in an array. I want to provide the users with the ability to select a line when they click on it. It becomes difficult to do this in HTML5 Canvas as the line is not represented by an object. The only option that I am left with is to first find that (x,y) coordinate of any line that is closest to the (x,y) of a mousedown event. Once I