From 364d79fafd425b52266a79b5b601ef13aebb1dd5 Mon Sep 17 00:00:00 2001 From: "hyojun.choi" Date: Wed, 21 May 2025 11:44:44 +0900 Subject: [PATCH] =?UTF-8?q?[1054]=20-=20=ED=98=BC=ED=95=A9=EB=AA=A8?= =?UTF-8?q?=EB=93=88=EC=9D=BC=20=EA=B2=BD=EC=9A=B0=20=EC=A7=80=EC=A7=80?= =?UTF-8?q?=EA=B8=88=EA=B5=AC=20=EC=84=A4=EC=B9=98=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/module/useTrestle.js | 50 ++++++++++++++++++++++++++++------ 1 file changed, 42 insertions(+), 8 deletions(-) diff --git a/src/hooks/module/useTrestle.js b/src/hooks/module/useTrestle.js index 32eef2a2..738a5289 100644 --- a/src/hooks/module/useTrestle.js +++ b/src/hooks/module/useTrestle.js @@ -441,7 +441,7 @@ export const useTrestle = () => { drawRacks(rightRacks, rackQty, rackIntvlPct / 3, module, direction, 'R', rackYn) } } - module.set({ leftRows, rightRows, centerRows }) + module.set({ leftRows, rightRows, centerRows, leftFindModuleList, rightFindModuleList, centerFindModuleList }) }) // 왼쪽아래에 모듈이 없는 모듈들 leftExposedHalfBottomModules.forEach((module) => { @@ -531,7 +531,7 @@ export const useTrestle = () => { drawRacks(leftRacks, rackQty, rackIntvlPct, module, direction, 'L', rackYn) } - module.set({ leftRows }) + module.set({ leftRows, leftFindModuleList: findModuleList }) }) // 오른쪽 아래에 모듈이 없는 모듈들 rightExposedHalfBottomPoints.forEach((module) => { @@ -612,7 +612,7 @@ export const useTrestle = () => { drawRacks(rightRacks, rackQty, rackIntvlPct, module, direction, 'R', rackYn) } - module.set({ rightRows }) + module.set({ rightRows, rightFindModuleList: findModuleList }) }) surface.set({ moduleRowsTotCnt: mostRowsModule }) @@ -1547,7 +1547,6 @@ export const useTrestle = () => { canvas.renderAll() exposedBottomModules.forEach((module) => { - canvas.renderAll() drawBracketWithOutRack(module, rackIntvlPct, module.leftRows + 1, 'L', surface.direction, moduleIntvlHor, moduleIntvlVer) drawBracketWithOutRack(module, rackIntvlPct, module.rightRows + 1, 'R', surface.direction, moduleIntvlHor, moduleIntvlVer) if (!isChidory && rackQty === 3) { @@ -1627,6 +1626,8 @@ export const useTrestle = () => { // 랙 없음의 지지금구를 그린다. const drawBracketWithOutRack = (module, rackIntvlPct, count, l, direction, moduleIntvlHor, moduleIntvlVer) => { + const { leftFindModuleList, rightFindModuleList, centerFindModuleList } = module + let { width, height, left, top } = module let startPointX let startPointY @@ -1723,6 +1724,39 @@ export const useTrestle = () => { } for (let i = 0; i < count; i++) { + let moduleWidth, moduleHeight + + switch (l) { + case 'L': { + let leftFindModule = leftFindModuleList[i] + if (!leftFindModule) { + leftFindModule = leftFindModuleList[leftFindModuleList.length - 1] + } + moduleWidth = leftFindModule.width + moduleHeight = leftFindModule.height + break + } + case 'R': { + let rightFindModule = rightFindModuleList[i] + if (!rightFindModule) { + rightFindModule = rightFindModuleList[rightFindModuleList.length - 1] + } + moduleWidth = rightFindModule.width + moduleHeight = rightFindModule.height + break + } + case 'C': { + let centerFindModule = centerFindModuleList[i] + if (!centerFindModule) { + centerFindModule = centerFindModuleList[centerFindModuleList.length - 1] + } + + moduleWidth = centerFindModule.width + moduleHeight = centerFindModule.height + break + } + } + const bracket = new fabric.Rect({ left: startPointX, top: startPointY, @@ -1739,13 +1773,13 @@ export const useTrestle = () => { canvas.renderAll() const maxIntvl = Math.max(moduleIntvlHor, moduleIntvlVer) if (direction === 'south') { - startPointY -= height + maxIntvl / 10 + startPointY -= moduleHeight + maxIntvl / 10 } else if (direction === 'north') { - startPointY += height + maxIntvl / 10 + startPointY += moduleHeight + maxIntvl / 10 } else if (direction === 'east') { - startPointX -= width + maxIntvl / 10 + startPointX -= moduleWidth + maxIntvl / 10 } else if (direction === 'west') { - startPointX += width + maxIntvl / 10 + startPointX += moduleWidth + maxIntvl / 10 } } }