From f650127c109fb65a589388cefb51eb990b151612 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Wed, 6 May 2015 01:57:11 -0400 Subject: experimental palette --- js/matrix.js | 53 ++++++++++++++++++++++++++++------------------------- 1 file changed, 28 insertions(+), 25 deletions(-) (limited to 'js/matrix.js') diff --git a/js/matrix.js b/js/matrix.js index bc09099..7327727 100644 --- a/js/matrix.js +++ b/js/matrix.js @@ -23,31 +23,31 @@ Matrix.prototype.rebuild = function (){ this.append() this.bind() this.generate && this.generate() - check_if_lost_focus() + check_if_lost_focus() } Matrix.prototype.clone = function () { - var base = this - var clone = new Matrix(this.w, this.h, function(x,y){ - return base.getCell(x,y).clone() - }) - clone.f = this.f - return clone + var base = this + var clone = new Matrix(this.w, this.h, function(x,y){ + return base.getCell(x,y).clone() + }) + clone.f = this.f + return clone } Matrix.prototype.assign = function (mat) { - var base = this - this.demolish() - this.w = mat.w - this.h = mat.h -// this.f = function(){} - this.initialize(function(x,y){ - var el = mat.getCell(x,y).clone() - el.build() - return el - }) + var base = this + this.demolish() + this.w = mat.w + this.h = mat.h +// this.f = function(){} + this.initialize(function(x,y){ + var el = mat.getCell(x,y).clone() + el.build() + return el + }) this.append() this.bind() - check_if_lost_focus() - return this + check_if_lost_focus() + return this } Matrix.prototype.bind = function () {} @@ -85,14 +85,17 @@ Matrix.prototype.clear = function(){ Matrix.prototype.erase = function(){ this.forEach(function(lex,x,y){ lex.erase() }) } -Matrix.prototype.fill = function(fg, bg){ - this.fg = fg - this.bg = bg - this.forEach(function(lex,x,y){ - lex.fill(fg,bg) - lex.build() +Matrix.prototype.fill = function(lex){ + this.fg = lex.fg + this.bg = lex.bg + this.char = lex.char + this.opacity = lex.opacity + this.forEach(function(el,x,y){ + el.fill(lex) + el.build() }) } + Matrix.prototype.build = function(){ this.forEach(function(lex,x,y){ lex.build() -- cgit v1.2.3-70-g09d2