summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--js/app.js21
-rw-r--r--js/lex.js8
-rw-r--r--js/matrix.js2
3 files changed, 19 insertions, 12 deletions
diff --git a/js/app.js b/js/app.js
index 9c27a3f..1e975ea 100644
--- a/js/app.js
+++ b/js/app.js
@@ -1,7 +1,7 @@
var contentType = 'text/plain;charset=utf-8'
-var cols = 10
-var rows = 5
+var cols = 200
+var rows = 200
var dragging = false
var drawing = true
var erasing = false
@@ -37,7 +37,6 @@ function build () {
})
palette = new Matrix (32, 2, function(x,y){
var lex = new Lex (x,y)
- console.log(color_hue_order[y>>1])
lex.bg = colors[color_hue_order[y>>1]]
lex.build()
return lex
@@ -172,18 +171,26 @@ function bind () {
})
controls.canvas_width.key = int_key(function(n, keyCode){
+ if (controls.canvas_width.char.length == 1) {
+ n = parseInt(controls.canvas_width.char) * 10 + n
+ }
controls.canvas_width.blur()
controls.canvas_width.char = ""+n
controls.canvas_width.build()
- brush.w = n
- brush.rebuild()
+ canvas.w = n
+ canvas.rebuild()
})
controls.canvas_height.key = int_key(function(n, keyCode){
+ console.log(controls.canvas_height.char.length)
+ console.log(controls.canvas_height.char,n)
+ if (controls.canvas_height.char.length == 1) {
+ n = parseInt(controls.canvas_height.char) * 10 + n
+ }
controls.canvas_height.blur()
controls.canvas_height.char = ""+n
controls.canvas_height.build()
- brush.h = n
- brush.rebuild()
+ canvas.h = n
+ canvas.rebuild()
})
window.addEventListener('keydown', function(e){
diff --git a/js/lex.js b/js/lex.js
index 723546a..f235672 100644
--- a/js/lex.js
+++ b/js/lex.js
@@ -19,15 +19,15 @@ Lex.prototype.css = function(){
return "f" + letters[this.fg&15] + "b" + letters[this.bg&15]
}
Lex.prototype.html = function(){
- return this.char == " " ? " " : this.char
+ return this.char == " " ? " " : this.char || " "
}
Lex.prototype.irc = function(){
+ var char = this.char == "%" ? '%%' : this.char || " "
if (this.bg == 1 && this.fg == 0) {
-// return "\\x03" + "," + (this.bg&15) + this.char
- return this.char == "%" ? '%%' : this.char
+ return char
}
else {
- return "\\x03" + (this.fg&15) + "," + (this.bg&15) + (this.char == "%" ? '%%' : this.char)
+ return "\\x03" + (this.fg&15) + "," + (this.bg&15) + char
}
}
Lex.prototype.clone = function (lex){
diff --git a/js/matrix.js b/js/matrix.js
index 8108568..a36d3db 100644
--- a/js/matrix.js
+++ b/js/matrix.js
@@ -5,7 +5,7 @@ function Matrix (w,h,f){
this.initialize()
}
Matrix.prototype.initialize = function(){
- var w = this.w, h = this.h, f = this.f
+ var w = this.w || 1, h = this.h || 1, f = this.f
var aa = new Array (h)
for (var i = 0; i < h; i++) {
aa[i] = new Array (w)