diff --git a/src/hooks/common/useRoofFn.js b/src/hooks/common/useRoofFn.js index 38246273..0635b89e 100644 --- a/src/hooks/common/useRoofFn.js +++ b/src/hooks/common/useRoofFn.js @@ -202,7 +202,7 @@ export function useRoofFn() { } const roof = roofBase[0] - const wall = roof.wall + const wall = canvas.getObjects().find((obj) => obj.name === POLYGON_TYPE.WALL && obj.attributes?.roofId === roof.id) const checkPolygon = new fabric.Polygon(roof.points, { name: 'moveRoofPolygon', @@ -230,16 +230,11 @@ export function useRoofFn() { const texts = canvas.getObjects().filter((obj) => obj.type === 'text' && (obj.attributes?.roofId === roof.id || obj.parentId === roof.id)) texts.forEach((text) => canvas.remove(text)) - const outerLines = canvas.getObjects().filter((obj) => obj.type === 'QLine' && (obj.attributes?.roofId === roof.id || obj.parentId === roof.id)) - const allRoofObject = canvas .getObjects() - .filter( - (obj) => obj !== roof && /*obj !== wall &&*/ (obj.attributes?.roofId === roof.id || obj.parentId === roof.id || obj.parentId === wall.id), - ) - - // // Calculate the movement delta + .filter((obj) => obj !== roof && (obj.attributes?.roofId === roof.id || obj.parentId === roof.id || obj.parentId === wall.id)) + /** 지붕이 움직인 만큼의 delta를 구한다. */ const originalRoofLeft = roof.left const originalRoofTop = roof.top diff --git a/src/util/qpolygon-utils.js b/src/util/qpolygon-utils.js index 365fa119..32925a43 100644 --- a/src/util/qpolygon-utils.js +++ b/src/util/qpolygon-utils.js @@ -7585,6 +7585,8 @@ const reDrawPolygon = (polygon, canvas) => { selectable: polygon.selectable, fontSize: polygon.fontSize, wall: polygon.wall !== undefined ? polygon.wall : null, + originX: polygon.originX, + originY: polygon.originY, }) const newLines = newPolygon.lines @@ -7609,8 +7611,8 @@ const reDrawPolygon = (polygon, canvas) => { } }) - canvas?.add(newPolygon) - canvas?.renderAll() + canvas.add(newPolygon) + canvas.renderAll() return newPolygon }