Open
Description
Canvas 2D hit regions are experimental and required to be explicitly enabled on Chrome.
Hit regions result in much easier click-detection for 2D canvas elements as well as more efficient and readable code.
context.rect(10,10,100,100)
context.fill()
context.addHitRegion({"id": "Hit Region"})
canvas.onclick = event => {
if(event.region) alert("You clicked " + event.region)
}
I highly recommend having a discussion about this feature.