From abb73beee1f24f8f35f57d997d4eaf51e6c1c023 Mon Sep 17 00:00:00 2001 From: yjnoh Date: Mon, 11 Nov 2024 16:44:44 +0900 Subject: [PATCH] =?UTF-8?q?=EB=B0=B0=EC=B9=98=EB=A9=B4=20=EA=B3=84?= =?UTF-8?q?=EC=82=B0=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/surface/useSurfaceShapeBatch.js | 68 +---------------------- src/hooks/useContextMenu.js | 2 +- 2 files changed, 2 insertions(+), 68 deletions(-) diff --git a/src/hooks/surface/useSurfaceShapeBatch.js b/src/hooks/surface/useSurfaceShapeBatch.js index 2328b606..77beb6b1 100644 --- a/src/hooks/surface/useSurfaceShapeBatch.js +++ b/src/hooks/surface/useSurfaceShapeBatch.js @@ -828,72 +828,6 @@ export function useSurfaceShapeBatch() { canvas.renderAll() } - const surfaceShapeActualSize = () => { - const roofs = canvas.getObjects().filter((obj) => obj.name === 'roof') - let notParallelLines = [] - - const roofArray = [] - - roofs.forEach((obj) => { - const roof = { - id: obj.id, - surfaceId: obj.surfaceId, - targetLines: [], - baseLines: [], - direction: obj.direction, - } - obj.lines.forEach((line) => { - if (obj.direction === 'north' || obj.direction === 'south') { - if (line.y1 !== line.y2) { - roof.targetLines.push(line) - } else { - roof.baseLines.push(line) - } - } else { - if (line.x1 !== line.x2) { - roof.targetLines.push(line) - } else { - roof.baseLines.push(line) - } - } - }) - roofArray.push(roof) - }) - - const slopeRadians = slope.angleValue * (Math.PI / 180) - const tanSlope = Math.tan(slopeRadians) - - roofArray.forEach((roof) => { - roof.targetLines.forEach((line) => { - let calcLength = line.length - - if (roof.surfaceId === 1) { - calcLength = roof.direction === 'north' || roof.direction === 'south' ? Math.abs(line.y1 - line.y2) : Math.abs(line.x1 - line.x2) - } - - const h = calcLength * tanSlope - const resultLength = Math.sqrt(Math.pow(calcLength, 2) + Math.pow(h, 2)) - - line.set({ - attributes: { - ...line.attributes, - actualSize: parseInt((Math.floor(resultLength) * 10).toFixed(0)), - planeSize: parseInt(line.length * 10), - }, - }) - }) - roof.baseLines.forEach((line) => { - line.set({ - attributes: { - ...line.attributes, - actualSize: parseInt((Math.floor(line.length) * 10).toFixed(0)), - planeSize: parseInt(line.length * 10), - }, - }) - }) - }) - } - const changeSurfaceLinePropertyEvent = () => { let tmpLines = [] const roof = canvas.getActiveObject() @@ -998,7 +932,7 @@ export function useSurfaceShapeBatch() { deleteAllSurfacesAndObjects, moveSurfaceShapeBatch, resizeSurfaceShapeBatch, - surfaceShapeActualSize, + changeSurfaceLinePropertyEvent, changeSurfaceLineProperty, changeSurfaceLinePropertyReset, diff --git a/src/hooks/useContextMenu.js b/src/hooks/useContextMenu.js index f10f3d39..345f1de3 100644 --- a/src/hooks/useContextMenu.js +++ b/src/hooks/useContextMenu.js @@ -51,7 +51,7 @@ export function useContextMenu() { const [column, setColumn] = useState(null) const { handleZoomClear } = useCanvasEvent() const { moveObjectBatch } = useObjectBatch({}) - const { moveSurfaceShapeBatch, surfaceShapeActualSize } = useSurfaceShapeBatch() + const { moveSurfaceShapeBatch } = useSurfaceShapeBatch() const currentMenuSetting = () => { switch (currentMenu) { case MENU.PLAN_DRAWING: