Skip to content

Commit 97b6750

Browse files
committed
Update the width of title to not include quietZone
# Update the width of title to not include quietZone # Update the title backgroud to support transparent
1 parent 607119c commit 97b6750

File tree

4 files changed

+123
-9
lines changed

4 files changed

+123
-9
lines changed

QRCode.js

+7-6
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.8
6+
* Version 4.0.9
77
*
88
* @author [ [email protected] ]
99
*
@@ -1076,7 +1076,7 @@ Drawing.prototype.draw = function(oQRCode) {
10761076
if (_htOption.onRenderingStart) {
10771077
_htOption.onRenderingStart(_htOption)
10781078
}
1079-
1079+
10801080
var nCount = oQRCode.getModuleCount();
10811081
var nWidth = Math.round(_htOption.width / nCount);
10821082
var nHeight = Math.round((_htOption.height - _htOption.titleHeight) / nCount);
@@ -1091,7 +1091,7 @@ Drawing.prototype.draw = function(oQRCode) {
10911091

10921092
_htOption.width = nWidth * nCount;
10931093
_htOption.height = nHeight * nCount + _htOption.titleHeight;
1094-
this._canvas.height = _htOption.height + _htOption.quietZone * 2;
1094+
this._canvas.height = _htOption.height + _htOption.quietZone * 2;
10951095
this._canvas.width = _htOption.width + _htOption.quietZone * 2;
10961096

10971097
var autoColorDark = _htOption.autoColorDark;
@@ -1108,7 +1108,7 @@ Drawing.prototype.draw = function(oQRCode) {
11081108
_oContext.lineWidth = 0;
11091109
_oContext.fillStyle = _htOption.colorLight;
11101110
_oContext.fillRect(0, 0, this._canvas.width, this._canvas.height);
1111-
1111+
_oContext.clearRect(_htOption.quietZone, _htOption.quietZone, _htOption.width, _htOption.titleHeight);
11121112

11131113
var t = this;
11141114

@@ -1300,7 +1300,8 @@ Drawing.prototype.draw = function(oQRCode) {
13001300

13011301
if (_htOption.title) {
13021302
_oContext.fillStyle = _htOption.titleBackgroundColor;
1303-
_oContext.fillRect(0, 0, t._canvas.width, _htOption.titleHeight + this._htOption.quietZone);
1303+
// _oContext.fillRect(0, 0, t._canvas.width, _htOption.titleHeight + this._htOption.quietZone);
1304+
_oContext.fillRect(_htOption.quietZone, _htOption.quietZone, _htOption.width, _htOption.titleHeight);
13041305

13051306
_oContext.font = _htOption.titleFont;
13061307
_oContext.fillStyle = _htOption.titleColor;
@@ -1546,7 +1547,7 @@ function QRCode(canvas, vOption) {
15461547
this._htOption[i] = vOption[i];
15471548
}
15481549
}
1549-
1550+
15501551
if (!this._htOption.title && !this._htOption.subTitle) {
15511552
this._htOption.titleHeight = 0;
15521553
}

QRCode.min.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

+113
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "easyqrcode-react-native",
3-
"version": "4.0.8",
3+
"version": "4.0.9",
44
"description": "React Native QRCode generation component. Can get standard base64 image data url text or save image to file. Cross-browser QRCode generator for pure javascript. Support Dot style, Logo, Background image, Colorful, Title etc. settings. support binary mode.",
55
"main": "QRCode.min.js",
66
"scripts": {},

0 commit comments

Comments
 (0)