Search code examples
konvajs

What's the difference between `onClick` and `onContentClick` in konvajs


Stage have both click and contentClick and others, I check the doc and no place to explain their differences.

contentClick just a alias or have some particular function?


Solution

  • All content[Something] events are out of internal hit detection flow and out of event bubbling flow.

    When you listen to contentClick event you can't know what shape is clicked, because e.target is undefined.

    Historic note:

    Some time ago click event was not triggering when you click on empty space of the stage. So that is the case where contentClick event was useful. But that behavior is fixed.