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);
});
Frage
In kinetic js, how to detect if the user clicks on the empty canvas area? Thanks
Lösung
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);
});