From 73334f858e86e6ae0b13b38f6478305eadc44dd3 Mon Sep 17 00:00:00 2001 From: jiarwang <2186000761@qq.com> Date: Wed, 14 Nov 2018 19:01:58 +0800 Subject: [PATCH] =?UTF-8?q?Add:=20=E4=B8=89=E4=B8=AA=E5=A4=A7=E7=9A=84?= =?UTF-8?q?=E5=AE=9A=E4=BD=8D=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/QRCode.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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);