qrcode-generator
Advanced tools
Comparing version 1.3.0 to 1.3.1
{ | ||
"name": "qrcode-generator", | ||
"version": "1.3.0", | ||
"version": "1.3.1", | ||
"description": "QR Code Generator implementation in JavaScript.", | ||
@@ -5,0 +5,0 @@ "author": "Kazuhiko Arase", |
@@ -425,2 +425,29 @@ //--------------------------------------------------------------------- | ||
_this.make = function() { | ||
if (_typeNumber < 1) { | ||
var typeNumber = 1; | ||
for (; typeNumber < 40; typeNumber++) { | ||
var rsBlocks = QRRSBlock.getRSBlocks(typeNumber, _errorCorrectionLevel); | ||
var buffer = qrBitBuffer(); | ||
for (var i = 0; i < _dataList.length; i++) { | ||
var data = _dataList[i]; | ||
buffer.put(data.getMode(), 4); | ||
buffer.put(data.getLength(), QRUtil.getLengthInBits(data.getMode(), typeNumber) ); | ||
data.write(buffer); | ||
} | ||
var totalDataCount = 0; | ||
for (var i = 0; i < rsBlocks.length; i++) { | ||
totalDataCount += rsBlocks[i].dataCount; | ||
} | ||
if (buffer.getLengthInBits() <= totalDataCount * 8) { | ||
break; | ||
} | ||
} | ||
_typeNumber = typeNumber; | ||
} | ||
makeImpl(false, getBestMaskPattern() ); | ||
@@ -479,7 +506,8 @@ }; | ||
qrSvg += '<svg'; | ||
qrSvg += '<svg version="1.1" xmlns="http://www.w3.org/2000/svg"'; | ||
qrSvg += ' width="' + size + 'px"'; | ||
qrSvg += ' height="' + size + 'px"'; | ||
qrSvg += ' xmlns="http://www.w3.org/2000/svg"'; | ||
qrSvg += '>'; | ||
qrSvg += ' viewBox="0 0 ' + size + ' ' + size + '" '; | ||
qrSvg += ' preserveAspectRatio="xMinYMin meet">'; | ||
qrSvg += '<rect width="100%" height="100%" fill="white" cx="0" cy="0"/>'; | ||
qrSvg += '<path d="'; | ||
@@ -486,0 +514,0 @@ |
@@ -31,6 +31,6 @@ QR Code Generator | ||
| Param | Type | Description | | ||
| ---------------------| ------------------- | ------------------------------------------- | | ||
| typeNumber | <code>number</code> | Type number (1 ~ 40) | | ||
| errorCorrectionLevel | <code>string</code> | Error correction level ('L', 'M', 'Q', 'H') | | ||
| Param | Type | Description | | ||
| ---------------------| ------------------- | ---------------------------------------------- | | ||
| typeNumber | <code>number</code> | Type number (1 ~ 40), or 0 for auto detection. | | ||
| errorCorrectionLevel | <code>string</code> | Error correction level ('L', 'M', 'Q', 'H') | | ||
@@ -43,3 +43,3 @@ #### qrcode.stringToBytes(s) : <code>number[]</code> | ||
| Param | Type | Description | | ||
| -------| ------------------- | ---------------- | | ||
| ------ | ------------------- | ---------------- | | ||
| s | <code>string</code> | string to encode | | ||
@@ -53,3 +53,3 @@ | ||
| Param | Type | Description | | ||
| -------| ------------------- | ---------------------------------------------------------- | | ||
| ------ | ------------------- | ---------------------------------------------------------- | | ||
| data | <code>string</code> | string to encode | | ||
@@ -70,3 +70,3 @@ | mode | <code>string</code> | Mode ('Numeric', 'Alphanumeric', 'Byte'(default), 'Kanji') | | ||
| Param | Type | Description | | ||
| ------| ------------------- | ------------------- | | ||
| ----- | ------------------- | ------------------- | | ||
| row | <code>number</code> | 0 ~ moduleCount - 1 | | ||
@@ -82,3 +82,3 @@ | col | <code>number</code> | 0 ~ moduleCount - 1 | | ||
| Param | Type | Description | | ||
| ---------| ------------------- | --------------------- | | ||
| -------- | ------------------- | --------------------- | | ||
| cellSize | <code>number</code> | default: 2 | | ||
@@ -85,0 +85,0 @@ | margin | <code>number</code> | default: cellSize * 4 | |
99318
1925