수동시 치조 여부에 따라 모듈 가운데 흡착
This commit is contained in:
parent
9bb72bfa3a
commit
c34a7fc54d
@ -100,7 +100,7 @@ export default function ObjectSetting({ id, pos = { x: 50, y: 230 } }) {
|
||||
]
|
||||
|
||||
return (
|
||||
<WithDraggable isShow={true} pos={pos} className="lrr" style={{ visibility: isHidden ? 'hidden' : 'visible' }}>
|
||||
<WithDraggable isShow={true} pos={pos} className="lrr" isHidden={isHidden}>
|
||||
<WithDraggable.Header title={getMessage('plan.menu.placement.surface.object')} onClose={() => closePopup(id)} />
|
||||
<WithDraggable.Body>
|
||||
<div className="modal-btn-wrap">
|
||||
|
||||
@ -64,9 +64,7 @@ export function useModuleBasicSetting(tabNum) {
|
||||
const { createRoofPolygon, createMarginPolygon, createPaddingPolygon } = useMode()
|
||||
|
||||
const { drawDirectionArrow } = usePolygon()
|
||||
|
||||
const moduleSetupOption = useRecoilValue(moduleSetupOptionState)
|
||||
|
||||
const setManualSetupMode = useSetRecoilState(toggleManualSetupModeState)
|
||||
|
||||
useEffect(() => {
|
||||
@ -440,6 +438,7 @@ export function useModuleBasicSetting(tabNum) {
|
||||
//레이아웃 수동설치 토글
|
||||
|
||||
const moduleSetupSurfaces = canvas?.getObjects().filter((obj) => obj.name === POLYGON_TYPE.MODULE_SETUP_SURFACE) //모듈설치면를 가져옴
|
||||
const isChidori = moduleSetupOption.isChidori
|
||||
|
||||
if (isManualModuleSetup) {
|
||||
if (isManualModuleLayoutSetup) {
|
||||
@ -617,15 +616,16 @@ export function useModuleBasicSetting(tabNum) {
|
||||
tempModule.left = holdCellCenterX - toFixedWithoutRounding(width / 2, 2)
|
||||
}
|
||||
|
||||
//움직이는 모듈왼쪽 -> 가운데
|
||||
if (Math.abs(smallLeft - holdCellCenterX) < snapDistance) {
|
||||
tempModule.left = holdCellCenterX + intvHor / 2
|
||||
if (isChidori) {
|
||||
//움직이는 모듈왼쪽 -> 가운데
|
||||
if (Math.abs(smallLeft - holdCellCenterX) < snapDistance) {
|
||||
tempModule.left = holdCellCenterX + intvHor / 2
|
||||
}
|
||||
// 오른쪽 -> 가운데
|
||||
if (Math.abs(smallRight - holdCellCenterX) < snapDistance) {
|
||||
tempModule.left = holdCellCenterX - width - intvHor / 2
|
||||
}
|
||||
}
|
||||
// 오른쪽 -> 가운데
|
||||
if (Math.abs(smallRight - holdCellCenterX) < snapDistance) {
|
||||
tempModule.left = holdCellCenterX - width - intvHor / 2
|
||||
}
|
||||
|
||||
//설치된 셀에 좌측에 스냅
|
||||
if (Math.abs(smallRight - holdCellLeft) < snapDistance) {
|
||||
// console.log('모듈 좌측 스냅')
|
||||
@ -659,21 +659,16 @@ export function useModuleBasicSetting(tabNum) {
|
||||
tempModule.top = holdCellCenterY - toFixedWithoutRounding(width / 2, 2)
|
||||
}
|
||||
|
||||
//위쪽 -> 가운데
|
||||
if (Math.abs(smallTop - holdCellCenterY) < snapDistance) {
|
||||
// console.log('holdCellCenterX', holdCellCenterX)
|
||||
// console.log('smallLeft', smallLeft)
|
||||
|
||||
// console.log('모듈 센터에 스냅')
|
||||
tempModule.top = holdCellCenterY + intvHor / 2
|
||||
|
||||
// console.log('tempModule.left', tempModule.left)
|
||||
if (isChidori) {
|
||||
//위쪽 -> 가운데
|
||||
if (Math.abs(smallTop - holdCellCenterY) < snapDistance) {
|
||||
tempModule.top = holdCellCenterY + intvHor / 2
|
||||
}
|
||||
// 밑 -> 가운데
|
||||
if (Math.abs(smallBottom - holdCellCenterY) < snapDistance) {
|
||||
tempModule.top = holdCellCenterY - height - intvHor / 2
|
||||
}
|
||||
}
|
||||
// 밑 -> 가운데
|
||||
if (Math.abs(smallBottom - holdCellCenterY) < snapDistance) {
|
||||
tempModule.top = holdCellCenterY - height - intvHor / 2
|
||||
}
|
||||
|
||||
//설치된 셀에 좌측에 스냅
|
||||
if (Math.abs(smallRight - holdCellLeft) < snapDistance) {
|
||||
// console.log('모듈 좌측 스냅')
|
||||
@ -881,8 +876,9 @@ export function useModuleBasicSetting(tabNum) {
|
||||
const manualModuleLayoutSetup = (layoutSetupRef) => {
|
||||
const moduleSetupSurfaces = canvas?.getObjects().filter((obj) => obj.name === POLYGON_TYPE.MODULE_SETUP_SURFACE) //모듈설치면를 가져옴
|
||||
|
||||
const isChidori = moduleSetupOption.isChidori
|
||||
const setupLocation = moduleSetupOption.setupLocation
|
||||
const isChidori = moduleSetupOption.isChidori //치도리 여부
|
||||
const setupLocation = moduleSetupOption.setupLocation //모듈 설치 위치 처마, 용마루
|
||||
const isMultiModule = checkedModule.length > 1 //멀티 모듈인지 아닌지 여부
|
||||
|
||||
if (isManualModuleLayoutSetup) {
|
||||
if (isManualModuleSetup) {
|
||||
@ -1117,15 +1113,16 @@ export function useModuleBasicSetting(tabNum) {
|
||||
tempModule.left = holdCellCenterX - toFixedWithoutRounding(width / 2, 2)
|
||||
}
|
||||
|
||||
//움직이는 모듈왼쪽 -> 가운데
|
||||
if (Math.abs(smallLeft - holdCellCenterX) < snapDistance) {
|
||||
tempModule.left = holdCellCenterX + intvHor / 2
|
||||
if (isChidori) {
|
||||
//움직이는 모듈왼쪽 -> 가운데
|
||||
if (Math.abs(smallLeft - holdCellCenterX) < snapDistance) {
|
||||
tempModule.left = holdCellCenterX + intvHor / 2
|
||||
}
|
||||
// 오른쪽 -> 가운데
|
||||
if (Math.abs(smallRight - holdCellCenterX) < snapDistance) {
|
||||
tempModule.left = holdCellCenterX - width - intvHor / 2
|
||||
}
|
||||
}
|
||||
// 오른쪽 -> 가운데
|
||||
if (Math.abs(smallRight - holdCellCenterX) < snapDistance) {
|
||||
tempModule.left = holdCellCenterX - width - intvHor / 2
|
||||
}
|
||||
|
||||
//설치된 셀에 좌측에 스냅
|
||||
if (Math.abs(smallRight - holdCellLeft) < snapDistance) {
|
||||
// console.log('모듈 좌측 스냅')
|
||||
@ -1159,21 +1156,16 @@ export function useModuleBasicSetting(tabNum) {
|
||||
tempModule.top = holdCellCenterY - toFixedWithoutRounding(width / 2, 2)
|
||||
}
|
||||
|
||||
//위쪽 -> 가운데
|
||||
if (Math.abs(smallTop - holdCellCenterY) < snapDistance) {
|
||||
// console.log('holdCellCenterX', holdCellCenterX)
|
||||
// console.log('smallLeft', smallLeft)
|
||||
|
||||
// console.log('모듈 센터에 스냅')
|
||||
tempModule.top = holdCellCenterY + intvHor / 2
|
||||
|
||||
// console.log('tempModule.left', tempModule.left)
|
||||
if (isChidori) {
|
||||
//위쪽 -> 가운데
|
||||
if (Math.abs(smallTop - holdCellCenterY) < snapDistance) {
|
||||
tempModule.top = holdCellCenterY + intvHor / 2
|
||||
}
|
||||
// 밑 -> 가운데
|
||||
if (Math.abs(smallBottom - holdCellCenterY) < snapDistance) {
|
||||
tempModule.top = holdCellCenterY - height - intvHor / 2
|
||||
}
|
||||
}
|
||||
// 밑 -> 가운데
|
||||
if (Math.abs(smallBottom - holdCellCenterY) < snapDistance) {
|
||||
tempModule.top = holdCellCenterY - height - intvHor / 2
|
||||
}
|
||||
|
||||
//설치된 셀에 좌측에 스냅
|
||||
if (Math.abs(smallRight - holdCellLeft) < snapDistance) {
|
||||
// console.log('모듈 좌측 스냅')
|
||||
@ -1256,6 +1248,7 @@ export function useModuleBasicSetting(tabNum) {
|
||||
|
||||
addCanvasMouseEventListener('mouse:up', (e) => {
|
||||
if (!inside) return
|
||||
|
||||
if (tempModule) {
|
||||
let startX, startY
|
||||
let installedLastHeightCoord = 0 //마지막으로 설치된 모듈의 좌표
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user