From 7365279bdaae61095ab47837aa156c9fa3d92653 Mon Sep 17 00:00:00 2001 From: "hyojun.choi" Date: Thu, 7 Nov 2024 10:52:11 +0900 Subject: [PATCH] =?UTF-8?q?=EC=A7=80=EB=B6=95=ED=98=95=EC=83=81=EC=84=A4?= =?UTF-8?q?=EC=A0=95=20=ED=8E=B8=EB=A5=98=20=EC=A7=80=EB=B6=95=20=EC=84=A0?= =?UTF-8?q?=ED=83=9D=20=EC=8B=9C=20=EB=B0=A9=ED=96=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/roofcover/useRoofShapeSetting.js | 7 ++++++- src/hooks/useMode.js | 3 +++ src/util/qpolygon-utils.js | 6 ++++-- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/hooks/roofcover/useRoofShapeSetting.js b/src/hooks/roofcover/useRoofShapeSetting.js index 2823415d..21948de0 100644 --- a/src/hooks/roofcover/useRoofShapeSetting.js +++ b/src/hooks/roofcover/useRoofShapeSetting.js @@ -170,6 +170,7 @@ export function useRoofShapeSetting(id) { //기존 wallLine 삭제 let outerLines + let direction switch (shapeNum) { case 1: { @@ -196,6 +197,7 @@ export function useRoofShapeSetting(id) { // 서쪽 initLineSetting() outerLines = canvas.getObjects().filter((obj) => obj.name === 'outerLine') + direction = 'west' outerLines.forEach((line) => { setWestAndEastRoof(line) @@ -240,6 +242,7 @@ export function useRoofShapeSetting(id) { case 6: { initLineSetting() outerLines = canvas.getObjects().filter((obj) => obj.name === 'outerLine') + direction = 'east' outerLines.forEach((line) => { setWestAndEastRoof(line) @@ -285,6 +288,7 @@ export function useRoofShapeSetting(id) { case 7: { initLineSetting() outerLines = canvas.getObjects().filter((obj) => obj.name === 'outerLine') + direction = 'south' outerLines.forEach((line) => { setSouthAndNorthRoof(line) @@ -329,6 +333,7 @@ export function useRoofShapeSetting(id) { case 8: { initLineSetting() outerLines = canvas.getObjects().filter((obj) => obj.name === 'outerLine') + direction = 'north' outerLines.forEach((line) => { setSouthAndNorthRoof(line) @@ -389,7 +394,7 @@ export function useRoofShapeSetting(id) { canvas.remove(obj) }) - const polygon = addPolygonByLines(outerLines, { name: POLYGON_TYPE.WALL }) + const polygon = addPolygonByLines(outerLines, { name: POLYGON_TYPE.WALL, direction }) polygon.lines = [...outerLines] addPitchTextsByOuterLines() diff --git a/src/hooks/useMode.js b/src/hooks/useMode.js index 486bc8e9..6f90b028 100644 --- a/src/hooks/useMode.js +++ b/src/hooks/useMode.js @@ -1746,6 +1746,9 @@ export function useMode() { return { x1: point.x, y1: point.y } }), ) + if (wall.direction) { + roof.direction = wall.direction + } roof.name = POLYGON_TYPE.ROOF roof.setWall(wall) diff --git a/src/util/qpolygon-utils.js b/src/util/qpolygon-utils.js index e373df8d..90deebfc 100644 --- a/src/util/qpolygon-utils.js +++ b/src/util/qpolygon-utils.js @@ -1340,6 +1340,7 @@ export const splitPolygonWithLines = (polygon) => { }) const newRoofs = removeDuplicatePolygons(roofs) + newRoofs.forEach((roofPoint, index) => { let defense, pitch const polygonLines = [...polygon.lines] @@ -1378,7 +1379,8 @@ export const splitPolygonWithLines = (polygon) => { } }) - const direction = representLine.direction + const direction = newRoofs.length === 1 ? polygon.direction : representLine.direction + const polygonDirection = polygon.direction switch (direction) { case 'top': @@ -1406,7 +1408,7 @@ export const splitPolygonWithLines = (polygon) => { originY: 'center', selectable: true, defense: defense, - direction: defense, + direction: newRoofs.length === 1 ? polygonDirection : defense, pitch: pitch, })