From ad5fa31576792226c4901d391ed711f811cc9c15 Mon Sep 17 00:00:00 2001 From: "hyojun.choi" Date: Mon, 22 Jun 2026 15:19:20 +0900 Subject: [PATCH] =?UTF-8?q?=EC=82=AC=EC=9D=B4=EC=A6=88=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD=20=EC=8B=9C=201.=20=EC=99=BC=EC=AA=BD=20=EC=9C=84=20?= =?UTF-8?q?=EA=B3=A0=EC=A0=95,=202.=20=EC=98=A4=EB=A5=B8=EC=AA=BD=20?= =?UTF-8?q?=EC=95=84=EB=9E=98=20=EA=B3=A0=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modal/auxiliary/AuxiliarySize.jsx | 25 +++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/src/components/floor-plan/modal/auxiliary/AuxiliarySize.jsx b/src/components/floor-plan/modal/auxiliary/AuxiliarySize.jsx index 9b473601..ae8d4164 100644 --- a/src/components/floor-plan/modal/auxiliary/AuxiliarySize.jsx +++ b/src/components/floor-plan/modal/auxiliary/AuxiliarySize.jsx @@ -88,15 +88,26 @@ export default function AuxiliarySize(props) { // 현재 선분의 길이와 입력된 길이의 차이를 구한다. const scaleFactor = Big(size).div(distance) - //1지점 선택일때는 2지점의 좌표, 2지점 선택일때는 1지점의 좌표를 조정한다. + // [SIZE-ANCHOR 2026-06-22] 저장된 x1/x2 끝점 순서가 라인마다 달라(왼쪽 선은 1지점이 위, 오른쪽 선은 1지점이 아래) + // 동일하게 늘려도 방향이 반대로 보이던 문제 수정. 화면 기준으로 1지점=왼쪽 위, 2지점=오른쪽 아래로 통일한다. + // (외벽선 오프셋 useWallLineOffsetSetting 의 "1지점=down/right, 2지점=up/left" 컨벤션과 동일) + // 수직선(x 동일)은 위쪽을, 그 외는 왼쪽을 1지점(왼쪽 위)으로 판별한다. + const VERTICAL_EPS = 1 // 캔버스 단위(≈10mm) — 이 이하의 x 차이는 수직선으로 간주 + const p1IsTopLeft = Math.abs(x1 - x2) > VERTICAL_EPS ? x1 < x2 : y1 <= y2 + const topLeft = p1IsTopLeft ? { x: x1, y: y1 } : { x: x2, y: y2 } + const bottomRight = p1IsTopLeft ? { x: x2, y: y2 } : { x: x1, y: y1 } + + //1지점(왼쪽 위) 고정 → 오른쪽 아래 끝점을 늘린다(down/right). 2지점(오른쪽 아래) 고정 → 왼쪽 위 끝점을 늘린다(up/left). if (checkedRadio === 1) { - const newX2 = Big(x1).plus(dx.times(scaleFactor)).toNumber() - const newY2 = Big(y1).plus(dy.times(scaleFactor)).toNumber() - currentObject.set({ x2: newX2, y2: newY2 }) + const newBrX = Big(topLeft.x).plus(Big(bottomRight.x).minus(topLeft.x).times(scaleFactor)).toNumber() + const newBrY = Big(topLeft.y).plus(Big(bottomRight.y).minus(topLeft.y).times(scaleFactor)).toNumber() + if (p1IsTopLeft) currentObject.set({ x2: newBrX, y2: newBrY }) + else currentObject.set({ x1: newBrX, y1: newBrY }) } else if (checkedRadio === 2) { - const newX1 = Big(x2).minus(dx.times(scaleFactor)).toNumber() - const newY1 = Big(y2).minus(dy.times(scaleFactor)).toNumber() - currentObject.set({ x1: newX1, y1: newY1 }) + const newTlX = Big(bottomRight.x).plus(Big(topLeft.x).minus(bottomRight.x).times(scaleFactor)).toNumber() + const newTlY = Big(bottomRight.y).plus(Big(topLeft.y).minus(bottomRight.y).times(scaleFactor)).toNumber() + if (p1IsTopLeft) currentObject.set({ x1: newTlX, y1: newTlY }) + else currentObject.set({ x2: newTlX, y2: newTlY }) } //planeSize와 actualSize를 재계산한다. currentObject.attributes.planeSize = calcLinePlaneSize({