So I'm basically trying to reproduce this behavior - detecting events for non-transparent pixels only (as seen when hovering over the lion) - but in vue-konva.
Here is the demo I'm working with. It basically just loads the image of lion and attaches the mouse events to it.
According to the doc, in order to have the event detection only for non-transparent pixels, I have to call methods cache()
and drawHitFromCache()
on the image object of lion.
At what point in code should these two methods be called in Vue? When I try to call them in the onload
callback of the Image (see the commented lines 46-47 in the demo), I get the following errors:
Konva error: Width or height of caching configuration equals 0. Caching is ignored.
and
Cannot read property 'scene' of undefined
Thank you!