토글면 되살리기

This commit is contained in:
yjnoh 2025-02-07 20:59:56 +09:00
parent dfc67cb7dd
commit 64f8443b3a

View File

@ -65,8 +65,6 @@ export function useModuleBasicSetting(tabNum) {
const common = moduleSelectionData.common const common = moduleSelectionData.common
const roofConstructions = moduleSelectionData.roofConstructions const roofConstructions = moduleSelectionData.roofConstructions
console.log('moduleSelectionData', moduleSelectionData)
const listParams = roofConstructions.map((item) => { const listParams = roofConstructions.map((item) => {
return { return {
...common, ...common,
@ -199,75 +197,79 @@ export function useModuleBasicSetting(tabNum) {
}) })
const isExistSurface = canvas.getObjects().find((obj) => obj.name === POLYGON_TYPE.MODULE_SETUP_SURFACE && obj.parentId === roof.id) const isExistSurface = canvas.getObjects().find((obj) => obj.name === POLYGON_TYPE.MODULE_SETUP_SURFACE && obj.parentId === roof.id)
canvas.remove(isExistSurface) if (isExistSurface) {
addTargetMouseEventListener('mousedown', isExistSurface, function () {
toggleSelection(isExistSurface)
})
} else {
let offsetLength = canvasSetting.roofSizeSet === '3' ? -30 : (trestleDetail.eaveIntvl / 10) * -1
setSurfaceShapePattern(roof, roofDisplay.column, true) //패턴 변경
const offsetPoints = offsetPolygon(roof.points, offsetLength) //안쪽 offset
//모듈설치영역?? 생성
let offsetLength = canvasSetting.roofSizeSet === '3' ? -30 : (trestleDetail.eaveIntvl / 10) * -1 const surfaceId = uuidv4()
setSurfaceShapePattern(roof, roofDisplay.column, true) //패턴 변경 let isNorth = false
const offsetPoints = offsetPolygon(roof.points, offsetLength) //안쪽 offset
//모듈설치영역?? 생성
const surfaceId = uuidv4() if (canvasSetting.roofSizeSet !== '3') {
let isNorth = false //북면이 있지만
if (roof.directionText && roof.directionText.indexOf('北') > -1) {
if (canvasSetting.roofSizeSet !== '3') { //북쪽일때 해당 서북서, 동북동은 제외한다고 한다
//북면이 있지만 if (!(roof.directionText.indexOf('西北西') > -1 || roof.directionText.indexOf('東北東') > -1)) {
if (roof.directionText && roof.directionText.indexOf('北') > -1) { isNorth = true
//북쪽일때 해당 서북서, 동북동은 제외한다고 한다 }
if (!(roof.directionText.indexOf('西北西') > -1 || roof.directionText.indexOf('東北東') > -1)) {
isNorth = true
} }
} }
//모듈설치면 생성
let setupSurface = new QPolygon(offsetPoints, {
stroke: 'red',
fill: 'rgba(255,255,255,0.1)',
strokeDashArray: [10, 4],
strokeWidth: 1,
lockMovementX: true,
lockMovementY: true,
lockRotation: true,
lockScalingX: true,
lockScalingY: true,
selectable: true,
parentId: roof.id, //가대 폴리곤의 임시 인덱스를 넣어줌
name: POLYGON_TYPE.MODULE_SETUP_SURFACE,
flowDirection: roof.direction,
direction: roof.direction,
flipX: roof.flipX,
flipY: roof.flipY,
surfaceId: surfaceId,
originX: 'center',
originY: 'center',
modules: [],
roofMaterial: roof.roofMaterial,
trestleDetail: trestleDetail,
isNorth: isNorth,
perPixelTargetFind: true,
// angle: -compasDeg,
})
setupSurface.setViewLengthText(false)
canvas.add(setupSurface) //모듈설치면 만들기
//지붕면 선택 금지
roof.set({
selectable: false, //선택 금지
// evented: false, //클릭 이벤트도 금지
})
canvas.renderAll()
//바로 들어올때
const setupModules = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.MODULE)
setupModules.forEach((obj) => {
canvas.bringToFront(obj)
})
//모듈설치면 클릭이벤트
addTargetMouseEventListener('mousedown', setupSurface, function () {
toggleSelection(setupSurface)
})
} }
//모듈설치면 생성
let setupSurface = new QPolygon(offsetPoints, {
stroke: 'red',
fill: 'rgba(255,255,255,0.1)',
strokeDashArray: [10, 4],
strokeWidth: 1,
lockMovementX: true,
lockMovementY: true,
lockRotation: true,
lockScalingX: true,
lockScalingY: true,
selectable: true,
parentId: roof.id, //가대 폴리곤의 임시 인덱스를 넣어줌
name: POLYGON_TYPE.MODULE_SETUP_SURFACE,
flowDirection: roof.direction,
direction: roof.direction,
flipX: roof.flipX,
flipY: roof.flipY,
surfaceId: surfaceId,
originX: 'center',
originY: 'center',
modules: [],
roofMaterial: roof.roofMaterial,
trestleDetail: trestleDetail,
isNorth: isNorth,
perPixelTargetFind: true,
// angle: -compasDeg,
})
setupSurface.setViewLengthText(false)
canvas.add(setupSurface) //모듈설치면 만들기
//지붕면 선택 금지
roof.set({
selectable: false, //선택 금지
// evented: false, //클릭 이벤트도 금지
})
canvas.renderAll()
//바로 들어올때
const setupModules = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.MODULE)
setupModules.forEach((obj) => {
canvas.bringToFront(obj)
})
//모듈설치면 클릭이벤트
addTargetMouseEventListener('mousedown', setupSurface, function () {
toggleSelection(setupSurface)
})
} }
let selectedModuleInstSurfaceArray = [] let selectedModuleInstSurfaceArray = []