Frage

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

War es hilfreich?

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);
});
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top