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;