A — a 新增方向
This commit is contained in:
parent
f6bd832749
commit
4a668c427e
|
@ -163,6 +163,52 @@ function listPoints(qrcode, params) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type === 3) {
|
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(<line opacity={opacity} x1={x + 0.5} y1={y + 0.5} x2={x + 0.5} y2={y + end - start - 1 + 0.5} strokeWidth={size} stroke={otherColor} strokeLinecap="round" key={id++}/>)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} 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(<line opacity={opacity} x1={x + 0.5} y1={y + 0.5} x2={x + end - start - 0.5} y2={y + 0.5} strokeWidth={size} stroke={otherColor} strokeLinecap="round" key={id++}/>)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (available[x][y]) {
|
||||||
|
pointList.push(<circle opacity={opacity} r={size / 2} key={id++} fill={otherColor} cx={x + 0.5} cy={y + 0.5}/>)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (type === 4) {
|
||||||
if (y === 0 || x === 0 || ((y > 0 && x > 0) && (!qrcode.isDark(x - 1, y - 1) || !ava2[x - 1][y - 1]))) {
|
if (y === 0 || x === 0 || ((y > 0 && x > 0) && (!qrcode.isDark(x - 1, y - 1) || !ava2[x - 1][y - 1]))) {
|
||||||
let start = 0;
|
let start = 0;
|
||||||
let end = 0;
|
let end = 0;
|
||||||
|
@ -186,8 +232,7 @@ function listPoints(qrcode, params) {
|
||||||
pointList.push(<circle opacity={opacity} r={size / 2} key={id++} fill={otherColor} cx={x + 0.5} cy={y + 0.5}/>)
|
pointList.push(<circle opacity={opacity} r={size / 2} key={id++} fill={otherColor} cx={x + 0.5} cy={y + 0.5}/>)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (type === 5) {
|
||||||
if (type === 4) {
|
|
||||||
if (x === 0 || y === nCount - 1 || ((x > 0 && y < nCount - 1) && (!qrcode.isDark(x - 1, y + 1) || !ava2[x - 1][y + 1]))) {
|
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 start = 0;
|
||||||
let end = 0;
|
let end = 0;
|
||||||
|
@ -211,7 +256,7 @@ function listPoints(qrcode, params) {
|
||||||
pointList.push(<circle opacity={opacity} r={size / 2} key={id++} fill={otherColor} cx={x + 0.5} cy={y + 0.5}/>)
|
pointList.push(<circle opacity={opacity} r={size / 2} key={id++} fill={otherColor} cx={x + 0.5} cy={y + 0.5}/>)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
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]))) {
|
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 start = 0;
|
||||||
let end = 0;
|
let end = 0;
|
||||||
|
@ -267,6 +312,7 @@ function getParamInfoLine() {
|
||||||
"左右",
|
"左右",
|
||||||
"上下",
|
"上下",
|
||||||
"纵横",
|
"纵横",
|
||||||
|
"回环",
|
||||||
"左上 — 右下",
|
"左上 — 右下",
|
||||||
"右上 — 左下",
|
"右上 — 左下",
|
||||||
"交叉"
|
"交叉"
|
||||||
|
@ -311,11 +357,12 @@ function getParamInfoLine2() {
|
||||||
{
|
{
|
||||||
type: ParamTypes.SELECTOR,
|
type: ParamTypes.SELECTOR,
|
||||||
key: '连线方向',
|
key: '连线方向',
|
||||||
default: 5,
|
default: 6,
|
||||||
choices: [
|
choices: [
|
||||||
"左右",
|
"左右",
|
||||||
"上下",
|
"上下",
|
||||||
"纵横",
|
"纵横",
|
||||||
|
"回环",
|
||||||
"左上 — 右下",
|
"左上 — 右下",
|
||||||
"右上 — 左下",
|
"右上 — 左下",
|
||||||
"交叉"
|
"交叉"
|
||||||
|
|
Loading…
Reference in New Issue