지붕 외곽선 함수 정리

맘에 안들어
디버깅 어려워
젠장젠장
This commit is contained in:
nalpari 2024-07-01 21:48:51 +09:00
parent 8f08393014
commit 901fccf82a

View File

@ -401,7 +401,9 @@ export function useMode() {
const newOuterlines = [] const newOuterlines = []
for (let i = 0; i < historyLines.current.length; i++) { for (let i = 0; i < historyLines.current.length; i++) {
const next = historyLines.current[i + 1] const next = historyLines.current[i + 1]
const prev = historyLines.current[i - 1] ?? historyLines.current[historyLines.current.length - 1] const prev =
historyLines.current[i - 1] ??
historyLines.current[historyLines.current.length - 1]
if (next) { if (next) {
if (next.direction === 'right') { if (next.direction === 'right') {
// 다름 라인이 오른쪽으로 이동 // 다름 라인이 오른쪽으로 이동
@ -427,7 +429,7 @@ export function useMode() {
newOuterlines.push({ newOuterlines.push({
x1: historyLines.current[i].x1 - 50, x1: historyLines.current[i].x1 - 50,
y1: historyLines.current[i].y1 - 50, y1: historyLines.current[i].y1 - 50,
x2: historyLines.current[i].x2 + 50, x2: historyLines.current[i].x2 - 50,
y2: historyLines.current[i].y2 + 50, y2: historyLines.current[i].y2 + 50,
}) })
} else { } else {
@ -450,10 +452,10 @@ export function useMode() {
}) })
} else { } else {
newOuterlines.push({ newOuterlines.push({
x1: historyLines.current[i].x1 - 50, x1: historyLines.current[i].x1 + 50,
y1: historyLines.current[i].y1 + 50, y1: historyLines.current[i].y1 - 50,
x2: historyLines.current[i].x2 - 50, x2: historyLines.current[i].x2 + 50,
y2: historyLines.current[i].y2 + 50, y2: historyLines.current[i].y2 - 50,
}) })
} }
} else { } else {
@ -473,7 +475,6 @@ export function useMode() {
y2: historyLines.current[i].y2 - 50, y2: historyLines.current[i].y2 - 50,
}) })
} }
} }
} else if (next.direction === 'top') { } else if (next.direction === 'top') {
if (historyLines.current[i].direction === 'right') { if (historyLines.current[i].direction === 'right') {
@ -496,17 +497,17 @@ export function useMode() {
// left // left
if (prev?.direction !== 'top') { if (prev?.direction !== 'top') {
newOuterlines.push({ newOuterlines.push({
x1: historyLines.current[i].x1 - 50, x1: historyLines.current[i].x1 + 50,
y1: historyLines.current[i].y1 - 50, y1: historyLines.current[i].y1 - 50,
x2: historyLines.current[i].x2 + 50, x2: historyLines.current[i].x2 - 50,
y2: historyLines.current[i].y2 - 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,
y1: historyLines.current[i].y1 + 50, y1: historyLines.current[i].y1 - 50,
x2: historyLines.current[i].x2 - 50, x2: historyLines.current[i].x2 + 50,
y2: historyLines.current[i].y2 + 50, y2: historyLines.current[i].y2 - 50,
}) })
} }
} }
@ -521,10 +522,10 @@ export function useMode() {
}) })
} else { } else {
newOuterlines.push({ newOuterlines.push({
x1: historyLines.current[i].x1 + 50, x1: historyLines.current[i].x1 - 50,
y1: historyLines.current[i].y1 - 50, y1: historyLines.current[i].y1 + 50,
x2: historyLines.current[i].x2 + 50, x2: historyLines.current[i].x2 - 50,
y2: historyLines.current[i].y2 - 50, y2: historyLines.current[i].y2 + 50,
}) })
} }
} else { } else {
@ -532,9 +533,9 @@ export function useMode() {
if (prev.direction !== 'bottom') { if (prev.direction !== 'bottom') {
newOuterlines.push({ newOuterlines.push({
x1: historyLines.current[i].x1 + 50, x1: historyLines.current[i].x1 + 50,
y1: historyLines.current[i].y1 + 50, y1: historyLines.current[i].y1 - 50,
x2: historyLines.current[i].x2 - 50, x2: historyLines.current[i].x2 - 50,
y2: historyLines.current[i].y2 + 50, y2: historyLines.current[i].y2 - 50,
}) })
} else { } else {
newOuterlines.push({ newOuterlines.push({