diff options
| author | Jules Laplace <jules@okfoc.us> | 2015-05-06 01:57:11 -0400 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2015-05-06 01:57:11 -0400 |
| commit | f650127c109fb65a589388cefb51eb990b151612 (patch) | |
| tree | 026bbb4921cd103b4eec3636393f537c6e903299 /js/matrix.js | |
| parent | 05f454468e71d61ae4f0674223066efa118955b0 (diff) | |
experimental palette
Diffstat (limited to 'js/matrix.js')
| -rw-r--r-- | js/matrix.js | 53 |
1 files changed, 28 insertions, 25 deletions
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() |
