refactor: 라인 8개 케이스 분기처리 추가
라인 6개 케이스와 겹치는 부분 분기 처리 스팀 팍팍 빠직빠직
This commit is contained in:
parent
9ef112e04d
commit
74816e0403
@ -456,12 +456,21 @@ export function useMode() {
|
|||||||
// 다름 라인이 오른쪽으로 이동
|
// 다름 라인이 오른쪽으로 이동
|
||||||
if (historyLines.current[i].direction === 'top') {
|
if (historyLines.current[i].direction === 'top') {
|
||||||
if (prev.direction !== 'right') {
|
if (prev.direction !== 'right') {
|
||||||
newOuterlines.push({
|
if(historyLines.current.length === 6) {
|
||||||
x1: historyLines.current[i].x1 - 50,
|
newOuterlines.push({
|
||||||
y1: historyLines.current[i].y1 + 50,
|
x1: historyLines.current[i].x1 - 50,
|
||||||
x2: historyLines.current[i].x2 - 50,
|
y1: historyLines.current[i].y1 + 50,
|
||||||
y2: historyLines.current[i].y2 - 50,
|
x2: historyLines.current[i].x2 - 50,
|
||||||
})
|
y2: historyLines.current[i].y2 - 50,
|
||||||
|
})
|
||||||
|
} else if(historyLines.current.length === 8) {
|
||||||
|
newOuterlines.push({
|
||||||
|
x1: historyLines.current[i].x1 + 50,
|
||||||
|
y1: historyLines.current[i].y1 - 50,
|
||||||
|
x2: historyLines.current[i].x2 + 50,
|
||||||
|
y2: historyLines.current[i].y2 + 50,
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
newOuterlines.push({
|
newOuterlines.push({
|
||||||
x1: historyLines.current[i].x1 + 50,
|
x1: historyLines.current[i].x1 + 50,
|
||||||
@ -473,12 +482,21 @@ export function useMode() {
|
|||||||
} else {
|
} else {
|
||||||
// bottom
|
// bottom
|
||||||
if (prev?.direction !== 'right') {
|
if (prev?.direction !== 'right') {
|
||||||
newOuterlines.push({
|
if(historyLines.current.length === 6) {
|
||||||
x1: historyLines.current[i].x1 - 50,
|
newOuterlines.push({
|
||||||
y1: historyLines.current[i].y1 - 50,
|
x1: historyLines.current[i].x1 - 50,
|
||||||
x2: historyLines.current[i].x2 - 50,
|
y1: historyLines.current[i].y1 - 50,
|
||||||
y2: historyLines.current[i].y2 + 50,
|
x2: historyLines.current[i].x2 - 50,
|
||||||
})
|
y2: historyLines.current[i].y2 + 50,
|
||||||
|
})
|
||||||
|
} else if(historyLines.current.length === 8) {
|
||||||
|
newOuterlines.push({
|
||||||
|
x1: historyLines.current[i].x1 + 50,
|
||||||
|
y1: historyLines.current[i].y1 + 50,
|
||||||
|
x2: historyLines.current[i].x2 + 50,
|
||||||
|
y2: historyLines.current[i].y2 - 50,
|
||||||
|
})
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
newOuterlines.push({
|
newOuterlines.push({
|
||||||
x1: historyLines.current[i].x1 - 50,
|
x1: historyLines.current[i].x1 - 50,
|
||||||
@ -491,12 +509,21 @@ export function useMode() {
|
|||||||
} else if (next.direction === 'left') {
|
} else if (next.direction === 'left') {
|
||||||
if (historyLines.current[i].direction === 'top') {
|
if (historyLines.current[i].direction === 'top') {
|
||||||
if (prev?.direction !== 'left') {
|
if (prev?.direction !== 'left') {
|
||||||
newOuterlines.push({
|
if(historyLines.current.length === 6) {
|
||||||
x1: historyLines.current[i].x1 + 50,
|
newOuterlines.push({
|
||||||
y1: historyLines.current[i].y1 + 50,
|
x1: historyLines.current[i].x1 + 50,
|
||||||
x2: historyLines.current[i].x2 + 50,
|
y1: historyLines.current[i].y1 + 50,
|
||||||
y2: historyLines.current[i].y2 - 50,
|
x2: historyLines.current[i].x2 + 50,
|
||||||
})
|
y2: historyLines.current[i].y2 - 50,
|
||||||
|
})
|
||||||
|
} else if(historyLines.current.length === 8) {
|
||||||
|
newOuterlines.push({
|
||||||
|
x1: historyLines.current[i].x1 - 50,
|
||||||
|
y1: historyLines.current[i].y1 - 50,
|
||||||
|
x2: historyLines.current[i].x2 - 50,
|
||||||
|
y2: historyLines.current[i].y2 + 50,
|
||||||
|
})
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
newOuterlines.push({
|
newOuterlines.push({
|
||||||
x1: historyLines.current[i].x1 - 50,
|
x1: historyLines.current[i].x1 - 50,
|
||||||
@ -508,12 +535,21 @@ export function useMode() {
|
|||||||
} else {
|
} else {
|
||||||
// bottom
|
// bottom
|
||||||
if (prev?.direction !== 'left') {
|
if (prev?.direction !== 'left') {
|
||||||
newOuterlines.push({
|
if(historyLines.current.length === 6) {
|
||||||
x1: historyLines.current[i].x1 + 50,
|
newOuterlines.push({
|
||||||
y1: historyLines.current[i].y1 - 50,
|
x1: historyLines.current[i].x1 + 50,
|
||||||
x2: historyLines.current[i].x2 + 50,
|
y1: historyLines.current[i].y1 - 50,
|
||||||
y2: historyLines.current[i].y2 + 50,
|
x2: historyLines.current[i].x2 + 50,
|
||||||
})
|
y2: historyLines.current[i].y2 + 50,
|
||||||
|
})
|
||||||
|
} else if(historyLines.current.length === 8) {
|
||||||
|
newOuterlines.push({
|
||||||
|
x1: historyLines.current[i].x1 - 50,
|
||||||
|
y1: historyLines.current[i].y1 + 50,
|
||||||
|
x2: historyLines.current[i].x2 - 50,
|
||||||
|
y2: historyLines.current[i].y2 - 50,
|
||||||
|
})
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
newOuterlines.push({
|
newOuterlines.push({
|
||||||
x1: historyLines.current[i].x1 - 50,
|
x1: historyLines.current[i].x1 - 50,
|
||||||
@ -526,12 +562,21 @@ export function useMode() {
|
|||||||
} else if (next.direction === 'top') {
|
} else if (next.direction === 'top') {
|
||||||
if (historyLines.current[i].direction === 'right') {
|
if (historyLines.current[i].direction === 'right') {
|
||||||
if (prev?.direction !== 'top') {
|
if (prev?.direction !== 'top') {
|
||||||
newOuterlines.push({
|
if(historyLines.current.length === 6) {
|
||||||
x1: historyLines.current[i].x1 - 50,
|
newOuterlines.push({
|
||||||
y1: historyLines.current[i].y1 + 50,
|
x1: historyLines.current[i].x1 - 50,
|
||||||
x2: historyLines.current[i].x2 + 50,
|
y1: historyLines.current[i].y1 + 50,
|
||||||
y2: historyLines.current[i].y2 + 50,
|
x2: historyLines.current[i].x2 + 50,
|
||||||
})
|
y2: historyLines.current[i].y2 + 50,
|
||||||
|
})
|
||||||
|
} else if(historyLines.current.length === 8) {
|
||||||
|
newOuterlines.push({
|
||||||
|
x1: historyLines.current[i].x1 + 50,
|
||||||
|
y1: historyLines.current[i].y1 - 50,
|
||||||
|
x2: historyLines.current[i].x2 - 50,
|
||||||
|
y2: historyLines.current[i].y2 - 50,
|
||||||
|
})
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
newOuterlines.push({
|
newOuterlines.push({
|
||||||
x1: historyLines.current[i].x1 + 50,
|
x1: historyLines.current[i].x1 + 50,
|
||||||
@ -543,12 +588,21 @@ export function useMode() {
|
|||||||
} else {
|
} else {
|
||||||
// left
|
// left
|
||||||
if (prev?.direction !== 'top') {
|
if (prev?.direction !== 'top') {
|
||||||
newOuterlines.push({
|
if(historyLines.current.length === 6) {
|
||||||
x1: historyLines.current[i].x1 + 50,
|
newOuterlines.push({
|
||||||
y1: historyLines.current[i].y1 + 50,
|
x1: historyLines.current[i].x1 + 50,
|
||||||
x2: historyLines.current[i].x2 - 50,
|
y1: historyLines.current[i].y1 + 50,
|
||||||
y2: historyLines.current[i].y2 + 50,
|
x2: historyLines.current[i].x2 - 50,
|
||||||
})
|
y2: historyLines.current[i].y2 + 50,
|
||||||
|
})
|
||||||
|
} else if(historyLines.current.length === 8) {
|
||||||
|
newOuterlines.push({
|
||||||
|
x1: historyLines.current[i].x1 - 50,
|
||||||
|
y1: historyLines.current[i].y1 - 50,
|
||||||
|
x2: historyLines.current[i].x2 + 50,
|
||||||
|
y2: historyLines.current[i].y2 - 50,
|
||||||
|
})
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
newOuterlines.push({
|
newOuterlines.push({
|
||||||
x1: historyLines.current[i].x1 - 50,
|
x1: historyLines.current[i].x1 - 50,
|
||||||
@ -561,12 +615,21 @@ export function useMode() {
|
|||||||
} else if (next.direction === 'bottom') {
|
} else if (next.direction === 'bottom') {
|
||||||
if (historyLines.current[i].direction === 'right') {
|
if (historyLines.current[i].direction === 'right') {
|
||||||
if (prev?.direction !== 'bottom') {
|
if (prev?.direction !== 'bottom') {
|
||||||
newOuterlines.push({
|
if(historyLines.current.length === 6) {
|
||||||
x1: historyLines.current[i].x1 - 50,
|
newOuterlines.push({
|
||||||
y1: historyLines.current[i].y1 - 50,
|
x1: historyLines.current[i].x1 - 50,
|
||||||
x2: historyLines.current[i].x2 + 50,
|
y1: historyLines.current[i].y1 - 50,
|
||||||
y2: historyLines.current[i].y2 - 50,
|
x2: historyLines.current[i].x2 + 50,
|
||||||
})
|
y2: historyLines.current[i].y2 - 50,
|
||||||
|
})
|
||||||
|
} else if(historyLines.current.length === 8) {
|
||||||
|
newOuterlines.push({
|
||||||
|
x1: historyLines.current[i].x1 + 50,
|
||||||
|
y1: historyLines.current[i].y1 + 50,
|
||||||
|
x2: historyLines.current[i].x2 - 50,
|
||||||
|
y2: historyLines.current[i].y2 + 50,
|
||||||
|
})
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
newOuterlines.push({
|
newOuterlines.push({
|
||||||
x1: historyLines.current[i].x1 - 50,
|
x1: historyLines.current[i].x1 - 50,
|
||||||
@ -578,12 +641,21 @@ export function useMode() {
|
|||||||
} else {
|
} else {
|
||||||
// left
|
// left
|
||||||
if (prev.direction !== 'bottom') {
|
if (prev.direction !== 'bottom') {
|
||||||
newOuterlines.push({
|
if(historyLines.current.length === 6) {
|
||||||
x1: historyLines.current[i].x1 + 50,
|
newOuterlines.push({
|
||||||
y1: historyLines.current[i].y1 - 50,
|
x1: historyLines.current[i].x1 + 50,
|
||||||
x2: historyLines.current[i].x2 - 50,
|
y1: historyLines.current[i].y1 - 50,
|
||||||
y2: historyLines.current[i].y2 - 50,
|
x2: historyLines.current[i].x2 - 50,
|
||||||
})
|
y2: historyLines.current[i].y2 - 50,
|
||||||
|
})
|
||||||
|
} else if(historyLines.current.length === 8) {
|
||||||
|
newOuterlines.push({
|
||||||
|
x1: historyLines.current[i].x1 - 50,
|
||||||
|
y1: historyLines.current[i].y1 + 50,
|
||||||
|
x2: historyLines.current[i].x2 + 50,
|
||||||
|
y2: historyLines.current[i].y2 + 50,
|
||||||
|
})
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
newOuterlines.push({
|
newOuterlines.push({
|
||||||
x1: historyLines.current[i].x1 - 50,
|
x1: historyLines.current[i].x1 - 50,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user