diff --git a/include/canvas.js b/include/canvas.js index 03a1e68..93aaff7 100644 --- a/include/canvas.js +++ b/include/canvas.js @@ -216,7 +216,7 @@ function constructor() { } /* Translate DOM key down/up event to keysym value */ -function getKeysym(e) { +that.getKeysym = function(e) { var evt, keysym; evt = (e ? e : window.event); @@ -362,24 +362,24 @@ function onMouseMove(e) { } function onKeyDown(e) { - //Util.Debug("keydown: " + getKeysym(e)); + //Util.Debug("keydown: " + that.getKeysym(e)); if (! conf.focused) { return true; } if (c_keyPress) { - c_keyPress(getKeysym(e), 1); + c_keyPress(that.getKeysym(e), 1); } Util.stopEvent(e); return false; } function onKeyUp(e) { - //Util.Debug("keyup: " + getKeysym(e)); + //Util.Debug("keyup: " + that.getKeysym(e)); if (! conf.focused) { return true; } if (c_keyPress) { - c_keyPress(getKeysym(e), 0); + c_keyPress(that.getKeysym(e), 0); } Util.stopEvent(e); return false; diff --git a/tests/keyboard.html b/tests/keyboard.html new file mode 100644 index 0000000..2d6df05 --- /dev/null +++ b/tests/keyboard.html @@ -0,0 +1,67 @@ + +