diff options
| author | Jules Laplace <jules@okfoc.us> | 2014-11-22 18:03:48 -0500 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2014-11-22 18:03:48 -0500 |
| commit | 8c544b08e8a855635007147cf21e795d74876025 (patch) | |
| tree | 748622ba33cd618a718a9e7f171366edef92254a /js/lex.js | |
| parent | d14b3d777182602093364874ceeccae1d595e3a9 (diff) | |
fixing cursor focus shit
Diffstat (limited to 'js/lex.js')
| -rw-r--r-- | js/lex.js | 43 |
1 files changed, 6 insertions, 37 deletions
@@ -1,5 +1,3 @@ -direction = [1,0] - function Lex (x,y) { if (typeof x == "number") { this.y = y @@ -82,40 +80,11 @@ Lex.prototype.demolish = function(){ this.span.parentNode.removeChild(this.span) this.span = null } + + Lex.prototype.key = function(char, keyCode) { - console.log(keyCode, this.y, this.x) - switch (keyCode) { - case 8: - canvas.focusLex(this.y-1, this.x) - focused.char = " " - focused.build() - return - case 13: // return - canvas.focusLex(0, this.x+1) - return - case 38: // up - direction[0] = 0 - direction[1] = -1 - break - case 40: // down - direction[0] = 0 - direction[1] = 1 - break - case 37: // left - direction[0] = -1 - direction[1] = 0 - break - case 39: // right - direction[0] = 1 - direction[1] = 0 - break - default: - if (! char) { return } - this.char = char - this.fg = brush.bg - this.build() - this.blur() - break - } - canvas.focusLex(this.y + direction[0], this.x + direction[1]) + if (! char) { return } + this.char = char + this.fg = brush.bg + this.build() } |
