diff --git a/src/components/QrRendererBase.js b/src/components/QrRendererBase.js index c43d9da..97bf7ee 100644 --- a/src/components/QrRendererBase.js +++ b/src/components/QrRendererBase.js @@ -1,29 +1,57 @@ import React from "react"; import './Qrcode.css' +import {getTypeTable, QRPointType} from "../utils/qrcodeHandler"; +import {rand} from "../utils/util"; function listPoint(props) { if (!props.qrcode) return [] const qrcode = props.qrcode; const nCount = qrcode.getModuleCount(); + const typeTable = getTypeTable(qrcode); const pointList = new Array(nCount); - let type = props.params[1]; - let size = props.params[0] / 100; + let type = props.params[0]; + let size = props.params[1] / 100; + let opacity = props.params[2] / 100; + let posType = props.params[3]; let id = 0; + console.log(posType) if (size <= 0) size = 1.0 - for (let row = 0; row < nCount; row++) { - for (let col = 0; col < nCount; col++) { - if (qrcode.isDark(row, col)) { + for (let x = 0; x < nCount; x++) { + for (let y = 0; y < nCount; y++) { + if (qrcode.isDark(x, y) == false) continue; + + if (typeTable[x][y] == QRPointType.ALIGN_CENTER || typeTable[x][y] == QRPointType.ALIGN_OTHER || typeTable[x][y] == QRPointType.TIMING) { if (type == 0) - pointList.push() + pointList.push() else if (type == 1) - pointList.push() + pointList.push() + } + else if (typeTable[x][y] == QRPointType.POS_CENTER) { + if (posType == 0) { + pointList.push(); + } else if (posType == 1) { + pointList.push() + pointList.push() + } + } + else if (typeTable[x][y] == QRPointType.POS_OTHER) { + if (posType == 0) { + pointList.push(); + } + } + else { + if (type == 0) + pointList.push() + else if (type == 1) + pointList.push() } } } + return pointList; } @@ -39,18 +67,30 @@ class QrRendererBase extends React.Component { super(props); if (this.props.setParamInfo) { this.props.setParamInfo([ - { - key: '大小', - default: 100 - }, - { - key: '定位点样式', - default: 0, - choices: [ - "矩形", - "圆形" - ] - } + { + key: '信息点样式', + default: 0, + choices: [ + "矩形", + "圆形" + ] + }, + { + key: '信息点缩放', + default: 100 + }, + { + key: '信息点不透明度', + default: 100, + }, + { + key: '定位点样式', + default: 0, + choices: [ + "矩形", + "圆形" + ] + }, ] ); } diff --git a/src/components/Qrcode.css b/src/components/Qrcode.css index c9e227e..407b3a6 100644 --- a/src/components/Qrcode.css +++ b/src/components/Qrcode.css @@ -384,4 +384,9 @@ a:hover { color: #1D1D1F; font-size: 14px; } +} + +select { + padding: 0; + background-color: #FFFFFF; } \ No newline at end of file