diff --git a/src/hooks/module/useModuleBasicSetting.js b/src/hooks/module/useModuleBasicSetting.js index 4e5e3534..126f064a 100644 --- a/src/hooks/module/useModuleBasicSetting.js +++ b/src/hooks/module/useModuleBasicSetting.js @@ -10,6 +10,7 @@ import { POLYGON_TYPE, BATCH_TYPE } from '@/common/common' import * as turf from '@turf/turf' import { v4 as uuidv4 } from 'uuid' import { useSwal } from '@/hooks/useSwal' +import { canvasSettingState } from '@/store/canvasAtom' export function useModuleBasicSetting() { const canvas = useRecoilValue(canvasState) @@ -18,7 +19,7 @@ export function useModuleBasicSetting() { const [moduleIsSetup, setModuleIsSetup] = useRecoilState(moduleIsSetupState) const { addTargetMouseEventListener, addCanvasMouseEventListener, initEvent } = useEvent() const { swalFire } = useSwal() - + const canvasSetting = useRecoilValue(canvasSettingState) // const { addTargetMouseEventListener, addCanvasMouseEventListener, initEvent } = useContext(EventContext) let selectedModuleInstSurfaceArray = [] @@ -64,6 +65,8 @@ export function useModuleBasicSetting() { const surfaceId = uuidv4() + console.log('roof.moduleCompass', roof.moduleCompass) + let setupSurface = new QPolygon(offsetPoints, { stroke: 'red', fill: 'transparent', @@ -815,9 +818,9 @@ export function useModuleBasicSetting() { if (isMaxSetup) totalHeight = totalHeight * 2 //최대배치시 2배로 늘려서 반씩 검사 for (let i = 0; i <= totalWidth; i++) { - bottomMargin = j === 0 ? 1 : 2 + bottomMargin = i === 0 ? 1 : 2 for (let j = 0; j < totalHeight; j++) { - leftMargin = i === 0 ? 1 : 2 + leftMargin = j === 0 ? 1 : 2 chidoriLength = 0 if (isChidori) { chidoriLength = i % 2 === 0 ? 0 : height / 2 @@ -1203,7 +1206,7 @@ export function useModuleBasicSetting() { const angle2 = Math.abs(Math.round(Math.atan(height2 / adjust2) * (180 / Math.PI) * 1000) / 1000) const angle3 = 180 - (angle1 + angle2) - const charlie = 173.3 + 3 // 평행선길이 약간 여유를 줌 + const charlie = 173.3 // 평행선길이 약간 여유를 줌 const alpha = (charlie * Math.sin((angle1 * Math.PI) / 180)) / Math.sin((angle3 * Math.PI) / 180) const beta = Math.sqrt(alpha ** 2 + charlie ** 2 - 2 * alpha * charlie * Math.cos((angle2 * Math.PI) / 180)) const h = beta * Math.sin((angle1 * Math.PI) / 180) // 높이 @@ -1318,7 +1321,7 @@ export function useModuleBasicSetting() { const angle2 = Math.abs(Math.round(Math.atan(adjust2 / height2) * (180 / Math.PI) * 1000) / 1000) const angle3 = 180 - (angle1 + angle2) - const charlie = 173.3 + 3 // 평행선길이 약간 여유를줌 + const charlie = 173.3 // 평행선길이 약간 여유를줌 const alpha = (charlie * Math.sin((angle1 * Math.PI) / 180)) / Math.sin((angle3 * Math.PI) / 180) const beta = Math.sqrt(alpha ** 2 + charlie ** 2 - 2 * alpha * charlie * Math.cos((angle2 * Math.PI) / 180)) @@ -1434,10 +1437,16 @@ export function useModuleBasicSetting() { return obj } + const manualFlatroofModuleSetup = () => {} + + const autoFlatroofModuleSetup = (placementFlatRef) => {} + return { makeModuleInstArea, manualModuleSetup, autoModuleSetup, restoreModuleInstArea, + manualFlatroofModuleSetup, + autoFlatroofModuleSetup, } }