From 0ba907cd239e138f09c199366d5407567ad6ad03 Mon Sep 17 00:00:00 2001 From: MarkoNiitsoo Date: Mon, 18 Nov 2013 16:18:57 +0200 Subject: [PATCH] I have modified div drawing method by joining side by side divs to one div. --- src/jquery.qrcode.js | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/src/jquery.qrcode.js b/src/jquery.qrcode.js index 15277b8..5d88178 100644 --- a/src/jquery.qrcode.js +++ b/src/jquery.qrcode.js @@ -352,7 +352,7 @@ position: 'absolute', padding: 0, margin: 0, - width: moduleSize, +// width: moduleSize, height: moduleSize, 'background-color': settings.fill }, @@ -364,16 +364,25 @@ } for (row = 0; row < moduleCount; row += 1) { - for (col = 0; col < moduleCount; col += 1) { + var left=0; + for (col = 0; col < moduleCount+1; col += 1) { if (qr.isDark(row, col)) { - $('
') - .css(darkCSS) - .css({ - left: offset + col * moduleSize, - top: offset + row * moduleSize - }) - .appendTo($div); - } + //lets remember the left point on dark area + if(!left)left=offset + col * moduleSize; + }else{ + //and when it's not dark area then we draw the dark div + if(left){ + $('
') + .css(darkCSS) + .css({ + left: left, + width: offset + col * moduleSize - left, + top: offset + row * moduleSize + }) + .appendTo($div); + left=0; + } + } } }