diff --git a/lib/QRCode.js b/lib/QRCode.js index 7471f47..a8ccacf 100644 --- a/lib/QRCode.js +++ b/lib/QRCode.js @@ -18,7 +18,6 @@ function renderCanvas(canvas) { canvas.height = size; canvas.style.left = (window.innerWidth - size) / 2 + 'px'; 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; @@ -30,6 +29,7 @@ function renderCanvas(canvas) { var nTop = rowIndex * cellHeight; ctx.fillStyle = ctx.strokeStyle = column ? bgColor : fgColor; ctx.lineWidth = 1; + ctx.clearRect(nLeft, nTop, cellWidth, cellHeight); ctx.fillRect(nLeft, nTop, cellWidth, cellHeight); ctx.strokeRect( Math.floor(nLeft) + 0.5, @@ -104,7 +104,7 @@ var QRCode = createReactClass({ render={renderCanvas} onLoad={this.props.onLoad} onLoadEnd={this.props.onLoadEnd} - style={{height: size, width: size}} + style={{height: size, width: size, backgroundColor: 'transparent' }} /> );