Object detection in bitmap JavaScript canvas

Posted by fallenAngel on Game Development See other posts from Game Development or by fallenAngel
Published on 2012-09-28T08:27:58Z Indexed on 2012/09/29 3:52 UTC
Read the original article Hit count: 289

I want to detect clicks on canvas elements which are drawn using paths. So far I have stored element paths in a JavaScript data structure and then check the coordinates of hits which match the element's coordinates. Rendering each element path and checking the hits would be inefficient when there are a lot of elements. I believe there must be an algorithm for this kind of coordinate search, can anyone help me with this?

© Game Development or respective owner

Related posts about algorithm

Related posts about JavaScript