Skip to content

Commit 50e296b

Browse files
committed
Height calculation optimization
Height calculation optimization
1 parent 80c004f commit 50e296b

File tree

8 files changed

+6
-27
lines changed

8 files changed

+6
-27
lines changed

demo/q2.jpg

430 Bytes
Loading

demo/q2.png

331 Bytes
Loading

demo/q3.jpg

876 Bytes
Loading

demo/q3.png

326 Bytes
Loading

demo/qrcode-stream.png

1.41 KB
Loading

index.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* NodeJS QRCode generator. Can save image or svg to file, get standard base64 image data url text or get SVG serialized text. Cross-browser QRCode generator for pure javascript. Support Dot style, Logo, Background image, Colorful, Title etc. settings. support binary mode.(Running without DOM on server side)
55
*
6-
* Version 4.4.3
6+
* Version 4.4.4
77
*
88
* @author [ [email protected] ]
99
*
@@ -1100,11 +1100,6 @@ var Drawing = function(htOption) {
11001100
Drawing.prototype.draw = function(oQRCode) {
11011101
var _htOption = this._htOption;
11021102

1103-
if (!_htOption.title && !_htOption.subTitle) {
1104-
_htOption.height -= _htOption.titleHeight;
1105-
_htOption.titleHeight = 0;
1106-
}
1107-
11081103
var nCount = oQRCode.getModuleCount();
11091104
var nWidth = Math.round(_htOption.width / nCount);
11101105
var nHeight = Math.round((_htOption.height - _htOption.titleHeight) / nCount);
@@ -1678,6 +1673,9 @@ function QRCode(vOption) {
16781673
}
16791674
}
16801675

1676+
if (!this._htOption.title && !this._htOption.subTitle) {
1677+
this._htOption.titleHeight = 0;
1678+
}
16811679
if (this._htOption.version < 0 || this._htOption.version > 40) {
16821680
console.warn("QR Code version '" + this._htOption.version + "' is invalidate, reset to 0")
16831681
this._htOption.version = 0;

index.min.js

Lines changed: 1 addition & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "easyqrcodejs-nodejs",
3-
"version": "4.4.3",
3+
"version": "4.4.4",
44
"description": "NodeJS QRCode generator. Can save image or svg to file, get standard base64 image data url text or get SVG serialized text. Cross-browser QRCode generator for pure javascript. Support Dot style, Logo, Background image, Colorful, Title etc. settings. support binary mode.(Running without DOM on server side)",
55
"main": "index.min.js",
66
"scripts": {},

0 commit comments

Comments
 (0)