html5 - Get Line co-ordinates in Javascript -
html5 - Get Line co-ordinates in Javascript -
i drawing lines using canvas (html 5), since lines/shapes not stored objects in canvas, cannot attach unique events (eg onmouseclick)
i wish attach onmouseover event line, possible getting know if mouse if on particular line (using 2 x , 2 y co-ordinates) in canvas using javascript. work different line widths (eg: 2,5 pixels)
want avoid using svg entire project built on canvas
please advice
you need utilize math formulas calculate area of line , whether point intersects it.
here's basic example:
find mouse coordinates relative position of canvas (how find mouse pos on element) calculate whether mouse x/y within rectangle (point in rectangle formula) done. javascript html5 javascript-events canvas
Comments
Post a Comment