diff --git a/lib/QRCode.js b/lib/QRCode.js index 7471f47..d0bc10c 100644 --- a/lib/QRCode.js +++ b/lib/QRCode.js @@ -20,14 +20,14 @@ function renderCanvas(canvas) { if(window.innerHeight > size) canvas.style.top = (window.innerHeight - size) / 2 + 'px'; ctx.fillRect(0, 0, size, size); var cells = this.cells; - var cellWidth = this.size / cells.length; - var cellHeight = this.size / cells.length; + var cellWidth = (this.size - 1)/ cells.length; + var cellHeight = (this.size - 1)/ cells.length; var nRoundedWidth = Math.round(cellWidth); var nRoundedHeight = Math.round(cellHeight); cells.forEach(function(row, rowIndex) { row.forEach(function(column, columnIndex) { - var nLeft = columnIndex * cellWidth; - var nTop = rowIndex * cellHeight; + var nLeft = columnIndex * cellWidth + 1; + var nTop = rowIndex * cellHeight + 1; ctx.fillStyle = ctx.strokeStyle = column ? bgColor : fgColor; ctx.lineWidth = 1; ctx.fillRect(nLeft, nTop, cellWidth, cellHeight);