- 변 속성에 따라 surface margin 값 적용
This commit is contained in:
parent
25b58dafec
commit
97d7798d56
@ -7,7 +7,7 @@ import offsetPolygon, { calculateAngle } from '@/util/qpolygon-utils'
|
||||
import { QPolygon } from '@/components/fabric/QPolygon'
|
||||
import { moduleSetupSurfaceState, moduleIsSetupState } from '@/store/canvasAtom'
|
||||
import { useEvent } from '@/hooks/useEvent'
|
||||
import { POLYGON_TYPE, BATCH_TYPE } from '@/common/common'
|
||||
import { POLYGON_TYPE, BATCH_TYPE, LINE_TYPE } from '@/common/common'
|
||||
import * as turf from '@turf/turf'
|
||||
import { useSwal } from '@/hooks/useSwal'
|
||||
import { compasDegAtom } from '@/store/orientationAtom'
|
||||
@ -22,6 +22,7 @@ import { v4 as uuidv4 } from 'uuid'
|
||||
// import { useCircuitTrestle } from '@/hooks/useCirCuitTrestle'
|
||||
import { isObjectNotEmpty } from '@/util/common-utils'
|
||||
import { useCircuitTrestle } from '@/hooks/useCirCuitTrestle'
|
||||
import { useMode } from '../useMode'
|
||||
|
||||
export function useModuleBasicSetting(tabNum) {
|
||||
const canvas = useRecoilValue(canvasState)
|
||||
@ -51,6 +52,7 @@ export function useModuleBasicSetting(tabNum) {
|
||||
|
||||
const [currentObject, setCurrentObject] = useRecoilState(currentObjectState)
|
||||
const { setModuleStatisticsData } = useCircuitTrestle()
|
||||
const { createRoofPolygon, createMarginPolygon } = useMode()
|
||||
|
||||
useEffect(() => {
|
||||
// console.log('basicSetting', basicSetting)
|
||||
@ -131,6 +133,7 @@ export function useModuleBasicSetting(tabNum) {
|
||||
//가대 상세 데이터 들어오면 실행
|
||||
useEffect(() => {
|
||||
if (trestleDetailList.length > 0) {
|
||||
console.log('trestleDetailList', trestleDetailList)
|
||||
//지붕을 가져옴
|
||||
canvas
|
||||
.getObjects()
|
||||
@ -143,6 +146,12 @@ export function useModuleBasicSetting(tabNum) {
|
||||
if (Number(detail.data.roofIndex) === roofIndex) {
|
||||
//roof에 상세 데이터 추가
|
||||
roof.set({ trestleDetail: detail.data })
|
||||
roof.lines.forEach((line) => {
|
||||
line.attributes = {
|
||||
...line.attributes,
|
||||
offset: getOffset(detail.data, line.attributes.type),
|
||||
}
|
||||
})
|
||||
//배치면 설치 영역
|
||||
makeModuleInstArea(roof, detail.data)
|
||||
//surface에 상세 데이터 추가
|
||||
@ -153,6 +162,18 @@ export function useModuleBasicSetting(tabNum) {
|
||||
}
|
||||
}, [trestleDetailList])
|
||||
|
||||
const getOffset = (data, type) => {
|
||||
switch (type) {
|
||||
case LINE_TYPE.WALLLINE.EAVES:
|
||||
return data.eaveIntvl / 10
|
||||
case LINE_TYPE.WALLLINE.GABLE:
|
||||
return data.kerabaIntvl / 10
|
||||
case LINE_TYPE.SUBLINE.RIDGE:
|
||||
return data.ridgeIntvl / 10
|
||||
default:
|
||||
return 60
|
||||
}
|
||||
}
|
||||
//선택 배치면 배열`
|
||||
let selectedModuleInstSurfaceArray = []
|
||||
|
||||
@ -220,7 +241,7 @@ export function useModuleBasicSetting(tabNum) {
|
||||
} else {
|
||||
let offsetLength = canvasSetting.roofSizeSet === '3' ? -30 : (trestleDetail.eaveIntvl / 10) * -1
|
||||
setSurfaceShapePattern(roof, roofDisplay.column, true, roof.roofMaterial) //패턴 변경
|
||||
const offsetPoints = offsetPolygon(roof.points, offsetLength) //안쪽 offset
|
||||
const offsetPoints = createMarginPolygon(createRoofPolygon(roof.getCurrentPoints()), roof.lines).vertices //안쪽 offset
|
||||
//모듈설치영역?? 생성
|
||||
|
||||
const surfaceId = uuidv4()
|
||||
|
||||
@ -5743,5 +5743,7 @@ export function useMode() {
|
||||
drawCellManualInTrestle,
|
||||
setDirectionTrestles,
|
||||
cutHelpLines,
|
||||
createRoofPolygon,
|
||||
createMarginPolygon,
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user