How to listen to Keydown-Events in a KineticJS-managed HTML5-Canvas?

JavascriptWeb DevelopmentFront End Scripts

To listen to KeyDown events, use −

if(keyIsPressed && keycode == somenumber) {
   doSomething();
}

To capture KeyDown −

var canvas1 = layer.getCanvas()._canvas;
$(canvas1).attr('tabindex', 1);
canvas1.focus();

$(canvas1).keydown(function (event) {
   console.log(event);
});
raja
Published on 06-Apr-2018 11:53:49
Advertisements