|
3 | 3 | * |
4 | 4 | * Cross-browser QRCode generator for pure javascript. Support Canvas, SVG and Table drawing methods. Support Dot style, Logo, Background image, Colorful, Title etc. settings. Support Angular, Vue.js, React, Next.js framework. Support binary(hex) data mode.(Running with DOM on client side) |
5 | 5 | * |
6 | | - * Version 4.1.0 |
| 6 | + * Version 4.2.1 |
7 | 7 | * |
8 | 8 | |
9 | 9 | * |
|
1284 | 1284 | } else { |
1285 | 1285 | // canvas |
1286 | 1286 | // this._elImage.crossOrigin='Anonymous'; |
1287 | | - if (_htOption.crossOrigin != null) { |
1288 | | - this._elImage.crossOrigin = _htOption.crossOrigin; |
1289 | | - } |
1290 | 1287 | try { |
| 1288 | + // if (this._htOption.crossOrigin != null) { |
| 1289 | + // this._elImage.crossOrigin = this._htOption.crossOrigin; |
| 1290 | + // } |
1291 | 1291 | var dataURL = this._elCanvas.toDataURL("image/png"); |
1292 | | - this._elImage.src = dataURL; |
| 1292 | + // this._elImage.src = dataURL; |
1293 | 1293 | this.dataURL = dataURL; |
1294 | | - this._elImage.style.display = "inline"; |
1295 | | - this._elCanvas.style.display = "none"; |
| 1294 | + // this._elImage.style.display = "inline"; |
| 1295 | + // this._elCanvas.style.display = "none"; |
1296 | 1296 | } catch (e) { |
1297 | 1297 | console.error(e) |
1298 | 1298 | } |
|
1395 | 1395 | this._elCanvas = document.createElement("canvas"); |
1396 | 1396 | this._el.appendChild(this._elCanvas); |
1397 | 1397 | this._oContext = this._elCanvas.getContext("2d"); |
1398 | | - this._elImage = document.createElement("img"); |
1399 | | - this._elImage.alt = "Scan me!"; |
1400 | | - this._elImage.style.display = "none"; |
1401 | | - this._el.appendChild(this._elImage); |
| 1398 | + // this._elImage = document.createElement("img"); |
| 1399 | + // this._elImage.alt = "Scan me!"; |
| 1400 | + // this._elImage.style.display = "none"; |
| 1401 | + // this._el.appendChild(this._elImage); |
1402 | 1402 | } |
1403 | 1403 |
|
1404 | 1404 | this._bSupportDataURI = null; |
|
1412 | 1412 | */ |
1413 | 1413 | Drawing.prototype.draw = function(oQRCode) { |
1414 | 1414 |
|
1415 | | - var _elImage = this._elImage; |
| 1415 | + // var _elImage = this._elImage; |
1416 | 1416 | var _htOption = this._htOption; |
1417 | 1417 |
|
1418 | 1418 |
|
|
1435 | 1435 | this._elCanvas.width = _htOption.width + _htOption.quietZone * 2; |
1436 | 1436 | this._elCanvas.height = _htOption.height + _htOption.quietZone * 2; |
1437 | 1437 |
|
1438 | | - if (this._htOption.drawer == 'canvas') { |
1439 | | - _elImage.style.display = "none"; |
1440 | | - } else { |
| 1438 | + if (this._htOption.drawer != 'canvas') { |
| 1439 | + // _elImage.style.display = "none"; |
| 1440 | + // } else { |
1441 | 1441 | this._oContext = new C2S(this._elCanvas.width, this._elCanvas.height); |
1442 | 1442 | } |
1443 | 1443 | this.clear(); |
|
1565 | 1565 |
|
1566 | 1566 | if (row == 6) { |
1567 | 1567 | // Timing Pattern |
| 1568 | + var timingHColorDark = _htOption.timing_H || _htOption.timing || |
| 1569 | + _htOption.colorDark; |
| 1570 | + _oContext.fillStyle = bIsDark ? timingHColorDark : _htOption.colorLight; |
| 1571 | + _oContext.strokeStyle = _oContext.fillStyle; |
| 1572 | + |
1568 | 1573 | nowDotScale = _htOption.dotScaleTiming_H; |
1569 | 1574 |
|
1570 | 1575 | _oContext.fillRect(nLeft + nWidth * (1 - nowDotScale) / 2, _htOption.titleHeight + |
|
1573 | 1578 | nowDotScale); |
1574 | 1579 | } else if (col == 6) { |
1575 | 1580 | // Timing Pattern |
| 1581 | + var timingVColorDark = _htOption.timing_V || _htOption.timing || |
| 1582 | + _htOption.colorDark; |
| 1583 | + _oContext.fillStyle = bIsDark ? timingVColorDark : _htOption.colorLight; |
| 1584 | + _oContext.strokeStyle = _oContext.fillStyle; |
| 1585 | + |
1576 | 1586 | nowDotScale = _htOption.dotScaleTiming_V; |
1577 | 1587 |
|
1578 | 1588 | _oContext.fillRect(nLeft + nWidth * (1 - nowDotScale) / 2, _htOption.titleHeight + |
|
0 commit comments