سؤال

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

هل كانت مفيدة؟

المحلول

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);
});
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top