I put an event handler on the stage in my application like so:
stage.on( 'click', onStageClick );
However, my event handler is not getting called. When I put a click event handler on the canvas that is created by the stage, like so:
$( stage.children[ 0 ].canvas._canvas ).on( 'click', onCanvasClick );
it does get called.
Is there something in between the stage
and the canvas
that could be eating the click event? Or ... what am I doing wrong?
Odd addendum: If I add an image
object to the layer
in the canvas ... then I do start getting the click
event on my stage
.
Any ideas what is going on?
Try contentClick
as your event.
From the KineticJS documentation:
The Kinetic Stage supports contentMouseover, contentMousemove, contentMouseout, contentMousedown, contentMouseup, contentClick, contentDblclick, contentTouchstart, contentTouchmove, contentTouchend, contentTap, and contentDblTap.
Here's a fiddle to demostrate: http://jsfiddle.net/klenwell/L5MLq/