Skip to content

Commit 63c3dd5

Browse files
committed
onRenderingEnd bug fixed
# onRenderingEnd bug fixed
1 parent 3b8c835 commit 63c3dd5

File tree

3 files changed

+14
-15
lines changed

3 files changed

+14
-15
lines changed

QRCode.js

+11-12
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* React Native QRCode generation component. Can generate standard QRCode image or base64 image data url text. Cross-browser QRCode generator for pure javascript. Support Dot style, Logo, Background image, Colorful, Title etc. settings. support binary mode.
55
*
6-
* Version 4.0.5
6+
* Version 4.0.6
77
*
88
* @author [ [email protected] ]
99
*
@@ -1080,7 +1080,7 @@ Drawing.prototype.draw = function(oQRCode) {
10801080
_htOption.height -= _htOption.titleHeight;
10811081
_htOption.titleHeight = 0;
10821082
}
1083-
1083+
10841084
var nCount = oQRCode.getModuleCount();
10851085
var nWidth = Math.round(_htOption.width / nCount);
10861086
var nHeight = Math.round((_htOption.height - _htOption.titleHeight) / nCount);
@@ -1093,10 +1093,10 @@ Drawing.prototype.draw = function(oQRCode) {
10931093

10941094
_htOption.quietZone = Math.round(_htOption.quietZone);
10951095

1096-
this._htOption.width = nWidth * nCount;
1097-
this._htOption.height = nHeight * nCount + _htOption.titleHeight;
1098-
this._canvas.height = this._htOption.height + this._htOption.quietZone * 2;
1099-
this._canvas.width = this._htOption.width + this._htOption.quietZone * 2;
1096+
_htOption.width = nWidth * nCount;
1097+
_htOption.height = nHeight * nCount + _htOption.titleHeight;
1098+
this._canvas.height = _htOption.height + _htOption.quietZone * 2;
1099+
this._canvas.width = _htOption.width + _htOption.quietZone * 2;
11001100

11011101
var autoColorDark = _htOption.autoColorDark;
11021102
var autoColorLight = _htOption.autoColorLight;
@@ -1110,7 +1110,7 @@ Drawing.prototype.draw = function(oQRCode) {
11101110

11111111
var _oContext = this._oContext;
11121112
_oContext.lineWidth = 0;
1113-
_oContext.fillStyle = this._htOption.colorLight;
1113+
_oContext.fillStyle = _htOption.colorLight;
11141114
_oContext.fillRect(0, 0, this._canvas.width, this._canvas.height);
11151115

11161116

@@ -1322,7 +1322,6 @@ Drawing.prototype.draw = function(oQRCode) {
13221322

13231323
if (_htOption.logo) {
13241324
var logoImg = new CanvasImage(t._canvas);
1325-
var _this = this;
13261325

13271326
function generateLogoImg(img) {
13281327
var imgContainerW = Math.round(_htOption.width / 3.5);
@@ -1399,12 +1398,12 @@ Drawing.prototype.draw = function(oQRCode) {
13991398
_oContext.drawImage(img, imgContainerX + (imgContainerW - imgW) / 2, imgContainerY +
14001399
(imgContainerH - imgH) / 2, imgW, imgH);
14011400

1402-
_this._bIsPainted = true;
1401+
t._bIsPainted = true;
14031402

14041403
drawQuietZoneColor();
14051404
if (_htOption.onRenderingEnd) {
14061405
_htOption.onRenderingEnd(_htOption, function() {
1407-
return _this._canvas.toDataURL();
1406+
return t._canvas.toDataURL();
14081407
});
14091408
}
14101409
}
@@ -1419,11 +1418,11 @@ Drawing.prototype.draw = function(oQRCode) {
14191418
logoImg.src = _htOption.logo;
14201419
} else {
14211420
drawQuietZoneColor();
1422-
this._bIsPainted = true;
1421+
t._bIsPainted = true;
14231422

14241423
if (_htOption.onRenderingEnd) {
14251424
_htOption.onRenderingEnd(_htOption, function() {
1426-
return _this._canvas.toDataURL();
1425+
return t._canvas.toDataURL();
14271426
});
14281427
}
14291428
}

0 commit comments

Comments
 (0)