diff --git a/src/components/floor-plan/modal/circuitTrestle/CircuitTrestleSetting.jsx b/src/components/floor-plan/modal/circuitTrestle/CircuitTrestleSetting.jsx index 9f1baec0..333bc0e7 100644 --- a/src/components/floor-plan/modal/circuitTrestle/CircuitTrestleSetting.jsx +++ b/src/components/floor-plan/modal/circuitTrestle/CircuitTrestleSetting.jsx @@ -147,12 +147,17 @@ export default function CircuitTrestleSetting({ id }) { const centerPoints = modules.map((module) => { const { x, y } = module.getCenterPoint() const { width, height } = module + // [RACK-AREA-SPEC 2026-07-02] 면적은 캔버스 측정치(Math.round(width/height)) 대신 모듈 스펙(longAxis×shortAxis)으로 산출. + // 측정치는 좌표 반올림으로 같은 모듈도 width 가 73/74 로 갈려 area 가 161 만큼 벌어져(=가짜 크기차) 랙 순서 위반 오판을 유발한다. + // 스펙 치수는 배치·회전과 무관해 동일 제품이면 항상 area 동일 → 반올림 잔차 제거. (gap 계산용 width/height 는 그대로 유지) + const specLong = Number(module.longAxis ?? module.moduleInfo?.longAxis ?? 0) / 10 + const specShort = Number(module.shortAxis ?? module.moduleInfo?.shortAxis ?? 0) / 10 return { x, y, width: Math.round(width), height: Math.round(height), - area: Math.round(width) * Math.round(height), + area: specLong * specShort, } }) diff --git a/src/hooks/module/useModule.js b/src/hooks/module/useModule.js index d72f43a6..1aa0e1ba 100644 --- a/src/hooks/module/useModule.js +++ b/src/hooks/module/useModule.js @@ -1072,8 +1072,14 @@ export function useModule() { // 정상 격자(정확히 30/3mm)도 측정 간격이 축소돼 위반 오판 → 모든 방향 이동 차단(회귀) 발생. const isTooCloseToOtherModules = (module, otherModules, surface) => { if (!otherModules || otherModules.length === 0) return false - const gapVer = Number(surface?.trestleDetail?.moduleIntvlVer ?? 0) / 10 // mm → canvas unit - const gapHor = Number(surface?.trestleDetail?.moduleIntvlHor ?? 0) / 10 + // [PLACE-CLEARANCE-SWAP 2026-07-02] 스냅 배치와 동일하게 flowDirection 으로 縦/横 간격을 캔버스 축에 매핑. + // 東/西 흐름에선 縦(moduleIntvlVer)이 캔버스 x축, 横(moduleIntvlHor)이 캔버스 y축이라 축이 뒤바뀐다. + // 스왑 없이 세로(캔버스 y) 적재에 항상 moduleIntvlVer 를 요구하면, 스냅이 moduleIntvlHor 로 붙인 정상 배치를 오판 거부한다. + const isEastWest = surface?.direction === 'east' || surface?.direction === 'west' + const intvlVerMm = Number(surface?.trestleDetail?.moduleIntvlVer ?? 0) + const intvlHorMm = Number(surface?.trestleDetail?.moduleIntvlHor ?? 0) + const gapVer = (isEastWest ? intvlHorMm : intvlVerMm) / 10 // 세로(캔버스 y) 적재 요구 간격 + const gapHor = (isEastWest ? intvlVerMm : intvlHorMm) / 10 // 가로(캔버스 x) 적재 요구 간격 if (gapVer <= 0 && gapHor <= 0) return false const EPS = 0.05 // 0.5mm — 좌표 반올림 잔차(±0.02) 흡수, 의미있는 위반은 통과 못함 const bboxOf = (o) => { diff --git a/src/hooks/module/useModuleBasicSetting.js b/src/hooks/module/useModuleBasicSetting.js index 19afa043..7907f79e 100644 --- a/src/hooks/module/useModuleBasicSetting.js +++ b/src/hooks/module/useModuleBasicSetting.js @@ -303,8 +303,14 @@ export function useModuleBasicSetting(tabNum) { // ⚠ 간격은 stroke 를 뺀 실제 정점(getCurrentPoints)으로 잰다. getBoundingRect 는 strokeWidth 팽창 → 정상 격자도 위반 오판. const isTooCloseToOtherModules = (module, otherModules, surface) => { if (!otherModules || otherModules.length === 0) return false - const gapVer = Number(surface?.trestleDetail?.moduleIntvlVer ?? 0) / 10 // mm → canvas unit - const gapHor = Number(surface?.trestleDetail?.moduleIntvlHor ?? 0) / 10 + // [PLACE-CLEARANCE-SWAP 2026-07-02] 스냅 배치(:824-831)와 동일하게 flowDirection 으로 縦/横 간격을 캔버스 축에 매핑. + // 東/西 흐름에선 縦(moduleIntvlVer)이 캔버스 x축, 横(moduleIntvlHor)이 캔버스 y축이라 축이 뒤바뀐다. + // 스왑 없이 세로(캔버스 y) 적재에 항상 moduleIntvlVer 를 요구하면, 스냅이 moduleIntvlHor 로 붙인 정상 배치를 오판 거부한다. + const isEastWest = surface?.direction === 'east' || surface?.direction === 'west' + const intvlVerMm = Number(surface?.trestleDetail?.moduleIntvlVer ?? 0) + const intvlHorMm = Number(surface?.trestleDetail?.moduleIntvlHor ?? 0) + const gapVer = (isEastWest ? intvlHorMm : intvlVerMm) / 10 // 세로(캔버스 y) 적재 요구 간격 + const gapHor = (isEastWest ? intvlVerMm : intvlHorMm) / 10 // 가로(캔버스 x) 적재 요구 간격 if (gapVer <= 0 && gapHor <= 0) return false const EPS = 0.05 // 0.5mm — 좌표 반올림 잔차(±0.02) 흡수 const bboxOf = (o) => {