diff options
| -rw-r--r-- | js/draw.js | 7 | ||||
| -rw-r--r-- | js/lex.js | 5 |
2 files changed, 6 insertions, 6 deletions
@@ -43,18 +43,19 @@ var draw = (function(){ } function stamp (canvas, brush, x, y, erasing) { - hh = brush.w/2|0 + var hh = brush.w/2|0 brush.forEach(function(lex, s, t){ s = round( s + x-hh ) t = round( t + y-hh ) - if (lex.opacity > 0 && s >= 0 && s < canvas.w && t >= 0 && t < canvas.h) { + if (s >= 0 && s < canvas.w && t >= 0 && t < canvas.h) { + if (lex.opacity === 0 && lex.char === ' ') return; var aa = canvas.aa[t][s] undo.save_lex(s, t, aa) if (erasing) { aa.erase(lex) } else { - aa.paint(lex) + aa.stamp(lex, brush) } } }) @@ -65,10 +65,9 @@ Lex.prototype.assign = function (lex){ this.opacity = lex.opacity this.build() } -Lex.prototype.paint = function (lex){ - if (lex.opacity == 0) return +Lex.prototype.stamp = function (lex, brush){ if (brush.draw_fg) this.fg = lex.fg - if (brush.draw_bg) this.bg = lex.bg + if (brush.draw_bg && lex.opacity > 0) this.bg = lex.bg if (brush.draw_char) this.char = lex.char this.opacity = 1 this.build() |
