Html5 canvas hittest arbitrary shape

前端 未结 2 744
北荒
北荒 2021-01-22 12:21

I\'m trying to develop program which can render images and text in canvas. I tried to handle click on image in canvas, but it work for rectable images.

My quest

2条回答
  •  北荒
    北荒 (楼主)
    2021-01-22 12:42

    I recommend using EaselJS which has a hitTest method similar to how it works in Actionscript:

    myDisplayObject.hitTest(localX, localY);
    

    Here you can find some demos that show the technique: http://shallaazm.com/createjs/easeljs/tutorials/HitTest/

提交回复
热议问题