From dacd7a06569f5f778a41f3518f23db605308b363 Mon Sep 17 00:00:00 2001
From: ciaochaos <1272777550@qq.com>
Date: Mon, 22 Jun 2020 12:03:45 +0800
Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=A0=B7=E5=BC=8F=20A=20?=
=?UTF-8?q?=E2=80=94=20b?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/components/renderer/RendererFunc.js | 72 +++++++++++++++----------
1 file changed, 45 insertions(+), 27 deletions(-)
diff --git a/src/components/renderer/RendererFunc.js b/src/components/renderer/RendererFunc.js
index 683d75f..6f5af9f 100644
--- a/src/components/renderer/RendererFunc.js
+++ b/src/components/renderer/RendererFunc.js
@@ -28,29 +28,15 @@ function listPoints(qrcode, params) {
if (size <= 0) size = 1.0
- function f(nCount, x, y, funcType) {
- const dist = Math.sqrt(Math.pow((nCount - 1)/2 - x, 2) + Math.pow((nCount - 1)/2 - y, 2)) / (nCount / 2 * Math.sqrt(2));
- let sizeF = 0
- let colorF = otherColor
- if (funcType === 0) {
- sizeF = (1 - Math.cos(Math.PI * dist))/6 + 1/5;
- }
- if (funcType === 1) {
- if (dist > 3/10 && dist < 2/5) {
- sizeF = 5/10
- colorF = otherColor2
- } else {
- sizeF = 1/5
- }
- }
- return [sizeF, colorF]
+
+ if (funcType === 1) {
+ pointList.push()
}
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.POS_CENTER) {
+ if (qrcode.isDark(x, y) && typeTable[x][y] === QRPointType.POS_CENTER) {
if (posType === 0) {
pointList.push();
} else if (posType === 1) {
@@ -70,20 +56,52 @@ function listPoints(qrcode, params) {
pointList.push()
}
}
- else if (typeTable[x][y] === QRPointType.POS_OTHER) {
+ else if (qrcode.isDark(x, y) && typeTable[x][y] === QRPointType.POS_OTHER) {
if (posType === 0) {
pointList.push();
}
}
else {
- if (type === 0) {
- const F = f(nCount, x, y, funcType);
- const sizeF = F[0] + 0.2;
- pointList.push()
+ const dist = Math.sqrt(Math.pow((nCount - 1)/2 - x, 2) + Math.pow((nCount - 1)/2 - y, 2)) / (nCount / 2 * Math.sqrt(2));
+ if (funcType === 0) {
+ let sizeF = (1 - Math.cos(Math.PI * dist))/6 + 1/5;
+ let colorF = otherColor;
+ let opacityF = Number(qrcode.isDark(x, y));
+ if (type === 0) {
+ sizeF = sizeF + 0.2;
+ pointList.push()
+ }
+ else if (type === 1) {
+ pointList.push()
+ }
}
- else if (type === 1) {
- const F = f(nCount, x, y, funcType);
- pointList.push()
+ if (funcType === 1) {
+ let sizeF = 0
+ let colorF = otherColor
+ let fillF = colorF
+ let opacityF = Number(qrcode.isDark(x, y));
+ if (dist > 5/20 && dist < 8/20) {
+ sizeF = 5/10
+ colorF = otherColor2
+ opacityF = 1
+ } else {
+ sizeF = 1/4
+ }
+ if (type === 0) {
+ sizeF = sizeF + 0.2;
+ if (qrcode.isDark(x, y)) {
+ pointList.push()
+ } else {
+ pointList.push()
+ }
+ }
+ else if (type === 1) {
+ if (qrcode.isDark(x, y)) {
+ pointList.push()
+ } else {
+ pointList.push()
+ }
+ }
}
}
}
@@ -190,7 +208,7 @@ function getParamInfoFuncB() {
{
type: ParamTypes.COLOR_EDITOR,
key: '信息点颜色 2',
- default: '#FF8200'
+ default: '#000000'
},
{
type: ParamTypes.COLOR_EDITOR,