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
Updated on 25-Jun-2020 07:45:02

Advertisements