4 ms·
Correct! Disable Pointer Events has surprising utility!
by ABNW 3y ago
Correct! Disable Pointer Events has surprising utility!
- amelius 3y agoWhat if you wanted to add the requirement that the user had to click on 1 specific piece of confetti?
- nicky0 3y agoThen you have a fun programming challenge.
- MartijnHols 3y agoAdd a click event listener to the body and overlay the event-coordinates on the canvas.
- amelius 3y agoWill the canvas allow you to hit-test the confetti piece given the coordinate?
- eyelidlessness 3y agoCanvas draws raster images, anything resembling an object in your drawing logic is already tracked separately by necessity. So regardless, you’d presumably check against whatever data model you’re using to determine what to draw.
- lupire 3y agoBy what time the user clicks, there's no reason for the program to need to remember what they drew where.
- eyelidlessness 3y agoIf that’s the case, what other object with coordinates would you reference on a canvas to determine whether it was clicked?