From f9a58fb4aa07006fb0fc2618d8d46fe350ee2f33 Mon Sep 17 00:00:00 2001 From: ciaochaos <1272777550@qq.com> Date: Fri, 8 May 2020 14:52:53 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=96=B0=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/QrRenderer25D.js | 72 ++++++++++++--------------------- src/components/Qrcode.css | 3 ++ 2 files changed, 28 insertions(+), 47 deletions(-) diff --git a/src/components/QrRenderer25D.js b/src/components/QrRenderer25D.js index fd8bfdb..d8057a2 100644 --- a/src/components/QrRenderer25D.js +++ b/src/components/QrRenderer25D.js @@ -11,10 +11,10 @@ function listPoint(props) { const typeTable = getTypeTable(qrcode); const pointList = new Array(nCount); - let type = props.params[0]; - let size = props.params[1] / 100; - let opacity = props.params[2] / 100; - let posType = props.params[3]; + let size = 1.03; + let size2 = 1.03; + let height = props.params[0]; + let height2 = props.params[1]; let id = 0; const vw = [3, -3]; @@ -26,32 +26,21 @@ function listPoint(props) { const matrixString = 'matrix(' + String(X[0]) + ', ' + String(X[1]) + ', ' + String(Y[0]) + ', ' + String(Y[1]) + ', ' + String(Z[0]) + ', ' + String(Z[1]) + ')' - - if (size <= 0) size = 1.0 + if (height <= 0) height = 1.0; + if (height2 <= 0) height2 = 1.0; for (let x = 0; x < nCount; x++) { for (let y = 0; y < nCount; y++) { if (qrcode.isDark(x, y) == false) continue; - else if (typeTable[x][y] == QRPointType.POS_CENTER) { - if (posType == 0) { - pointList.push(); - pointList.push(); - pointList.push(); - } - } - else if (typeTable[x][y] == QRPointType.POS_OTHER) { - if (posType == 0) { - pointList.push(); - pointList.push(); - pointList.push(); - } + else if (typeTable[x][y] == QRPointType.POS_OTHER || typeTable[x][y] == QRPointType.POS_CENTER) { + pointList.push(); + pointList.push(); + pointList.push(); } else { - if (type == 0) { - pointList.push(); - pointList.push(); - pointList.push(); - } + pointList.push(); + pointList.push(); + pointList.push(); } } } @@ -59,36 +48,25 @@ function listPoint(props) { return pointList; } +function viewBox(qrcode) { + if (!qrcode) return '0 0 0 0'; + + const nCount = qrcode.getModuleCount(); + return String(-nCount) + ' ' + String(-nCount / 2) + ' ' + String(nCount * 2) + ' ' + String(nCount * 2); +} + export default class QrRenderer25D extends React.Component { constructor(props) { super(props); if (this.props.setParamInfo) { this.props.setParamInfo([ { - key: '信息点样式', - default: 0, - choices: [ - "矩形", - "圆形", - "随机" - ] + key: '柱体高度', + default: 1 }, { - key: '信息点缩放', - default: 100 - }, - { - key: '信息点不透明度', - default: 100, - }, - { - key: '定位点样式', - default: 0, - choices: [ - "矩形", - "圆形", - "行星", - ] + key: '定位点柱体高度', + default: 1, }, ] ); @@ -97,7 +75,7 @@ export default class QrRenderer25D extends React.Component { render() { return ( - {listPoint(this.props)} diff --git a/src/components/Qrcode.css b/src/components/Qrcode.css index c726719..17bb110 100644 --- a/src/components/Qrcode.css +++ b/src/components/Qrcode.css @@ -84,6 +84,8 @@ .Qr-item-image { /*padding: 23px;*/ + overflow: auto; + display: flex; background-color: white; width: calc((100vw - 56px) / 2); height: calc((100vw - 56px) / 2); @@ -105,6 +107,7 @@ } .Qr-item-image-inner { + justify-content: center; -webkit-transition-timing-function: ease-in-out; -moz-transition-timing-function: ease-in-out; transition-timing-function: ease-in-out; From a9c76d5972c0e90e51e03dc6adcaa5b838d08c7b Mon Sep 17 00:00:00 2001 From: ciaochaos <1272777550@qq.com> Date: Fri, 8 May 2020 15:35:08 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=8A=E4=B8=8B?= =?UTF-8?q?=E6=BB=91=E5=8A=A8=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Qrcode.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Qrcode.css b/src/components/Qrcode.css index 17bb110..7e5c9c5 100644 --- a/src/components/Qrcode.css +++ b/src/components/Qrcode.css @@ -84,7 +84,7 @@ .Qr-item-image { /*padding: 23px;*/ - overflow: auto; + overflow: hidden; display: flex; background-color: white; width: calc((100vw - 56px) / 2); From 5b9a0fb55e630416f9464af6637b1d8ed841452f Mon Sep 17 00:00:00 2001 From: ciaochaos <1272777550@qq.com> Date: Fri, 8 May 2020 15:48:23 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E8=81=94=E7=B3=BB=E6=96=B9=E5=BC=8F?= =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Footer.js | 2 +- src/components/Qrcode.js | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/components/Footer.js b/src/components/Footer.js index 69e2ed8..c761d50 100644 --- a/src/components/Footer.js +++ b/src/components/Footer.js @@ -8,7 +8,7 @@ class Footer extends React.Component { return (
-
作者ciaochaosCPunisher
+
作者ciaochaosCPunisher 丨 联系我们
Copyright © {currentYear} QRBTF. 保留所有权利。
diff --git a/src/components/Qrcode.js b/src/components/Qrcode.js index 77e0d9b..1b6357b 100644 --- a/src/components/Qrcode.js +++ b/src/components/Qrcode.js @@ -246,15 +246,17 @@ class Qrcode extends React.Component {