From f14bd7e76cd622a9b198d56e08c3af68452da587 Mon Sep 17 00:00:00 2001 From: Julie Lala Date: Fri, 21 Nov 2014 05:45:09 -0500 Subject: keyboard stuff --- index.html | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'index.html') diff --git a/index.html b/index.html index 3e0adae..eb916aa 100644 --- a/index.html +++ b/index.html @@ -13,6 +13,7 @@ body.grid .focused { border: 1px solid white; }
+
square @@ -190,6 +191,9 @@ function bind () { brush.rebuild() }) window.addEventListener('keydown', function(e){ + if (! e.metaKey && ! e.ctrlKey && ! e.altKey) { + e.preventDefault() + } switch (e.keyCode) { case 27: // esc if (focused) focused.blur() @@ -291,6 +295,11 @@ Lex.prototype.blur = function(){ 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) break @@ -402,7 +411,7 @@ function stamp (canvas, brush, x, y, erasing) { brush.forEach(function(lex, s, t){ s += x-hh t += y-hh - if (s >= 0 || s < canvas.w || t >= 0 && t < canvas.h) { + if (s >= 0 && s < canvas.w && t >= 0 && t < canvas.h) { canvas.aa[t][s].clone(lex) } }) -- cgit v1.2.3-70-g09d2