summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulie Lala <jules@okfoc.us>2014-11-21 05:45:09 -0500
committerJulie Lala <jules@okfoc.us>2014-11-21 05:45:09 -0500
commitf14bd7e76cd622a9b198d56e08c3af68452da587 (patch)
treee7789b50215f6a44014af111bd020ec2e857a83c
parent9ba07bc32cd856ab0188b2e149911e4826055d7d (diff)
keyboard stuff
-rw-r--r--index.html11
1 files changed, 10 insertions, 1 deletions
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; }
<body class="grid">
<div id="canvas_rapper" class="rapper"></div>
+<br clear="all">
<div id="palette_rapper" class="rapper"></div>
<div id="tools_rapper" class="rapper">
<span id="square_el" class="tool">square</span>
@@ -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)
}
})