html5 canvas clicking on bezier path shape detection

前端 未结 3 1611
眼角桃花
眼角桃花 2021-02-15 13:51

I have a canvas with some irregular shape drawings in it, and I would like to have a feedback when someone clicks on a specific one?

I\'ve been looking everywhere for th

3条回答
  •  悲&欢浪女
    2021-02-15 14:22

    You can use a pathiterator, that turns all shapes into approximated polygons. Then use a 'point in polygon' algorithm to check if the point is in the shape.

提交回复
热议问题