diff --git a/src/components/renderer/RendererLine.js b/src/components/renderer/RendererLine.js index 52241bb..a01917d 100644 --- a/src/components/renderer/RendererLine.js +++ b/src/components/renderer/RendererLine.js @@ -163,6 +163,52 @@ function listPoints(qrcode, params) { } if (type === 3) { + if (x > y ^ x + y < nCount) { + if (y === 0 || (y > 0 && (!qrcode.isDark(x, y - 1) || !ava2[x][y - 1]))) { + let start = 0; + let end = 0; + let ctn = true; + while (ctn && y + end < nCount) { + if (qrcode.isDark(x, y + end) && ava2[x][y + end] && end - start <=3) { + end++; + } else { + ctn = false; + } + } + if (end - start > 1) { + for (let i = start; i < end; i++) { + ava2[x][y + i] = false; + available[x][y + i] = false; + } + pointList.push() + } + } + } else { + if (x === 0 || (x > 0 && (!qrcode.isDark(x - 1, y) || !ava2[x - 1][y]))) { + let start = 0; + let end = 0; + let ctn = true; + while (ctn && x + end < nCount) { + if (qrcode.isDark(x + end, y) && ava2[x + end][y] && end - start <=3) { + end++; + } else { + ctn = false; + } + } + if (end - start > 1) { + for (let i = start; i < end; i++) { + ava2[x + i][y] = false; + available[x + i][y] = false; + } + pointList.push() + } + } + } + if (available[x][y]) { + pointList.push() + } + } + if (type === 4) { if (y === 0 || x === 0 || ((y > 0 && x > 0) && (!qrcode.isDark(x - 1, y - 1) || !ava2[x - 1][y - 1]))) { let start = 0; let end = 0; @@ -186,8 +232,7 @@ function listPoints(qrcode, params) { pointList.push() } } - - if (type === 4) { + if (type === 5) { if (x === 0 || y === nCount - 1 || ((x > 0 && y < nCount - 1) && (!qrcode.isDark(x - 1, y + 1) || !ava2[x - 1][y + 1]))) { let start = 0; let end = 0; @@ -211,7 +256,7 @@ function listPoints(qrcode, params) { pointList.push() } } - if (type === 5) { + if (type === 6) { if (x === 0 || y === nCount - 1 || ((x > 0 && y < nCount - 1) && (!qrcode.isDark(x - 1, y + 1) || !ava2[x - 1][y + 1]))) { let start = 0; let end = 0; @@ -267,6 +312,7 @@ function getParamInfoLine() { "左右", "上下", "纵横", + "回环", "左上 — 右下", "右上 — 左下", "交叉" @@ -311,11 +357,12 @@ function getParamInfoLine2() { { type: ParamTypes.SELECTOR, key: '连线方向', - default: 5, + default: 6, choices: [ "左右", "上下", "纵横", + "回环", "左上 — 右下", "右上 — 左下", "交叉"