From c76582f92f4686dff929bff706b24eb5d1058e78 Mon Sep 17 00:00:00 2001 From: timb Date: Sun, 13 Mar 2016 17:42:28 -0700 Subject: fix painting from brush cells with text and trans bg. renamed lex paint to lex stamp to match draw.js --- js/draw.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'js/draw.js') diff --git a/js/draw.js b/js/draw.js index 77e149b..cedfea2 100644 --- a/js/draw.js +++ b/js/draw.js @@ -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) } } }) -- cgit v1.2.3-70-g09d2