Question

In kinetic js, how to detect if the user clicks on the empty canvas area? Thanks

Était-ce utile?

La solution

Listen for click events on the stage like this:

$(stage.getContent()).on('click', function (event) {
    var pos=stage.getPointerPosition();
    var mouseX=parseInt(pos.x);
    var mouseY=parseInt(pos.y);
    console.log(mouseX,mouseY);
});
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top