From 64f8443b3a632c693c8581b66e9c4c469d49da1e Mon Sep 17 00:00:00 2001 From: yjnoh Date: Fri, 7 Feb 2025 20:59:56 +0900 Subject: [PATCH] =?UTF-8?q?=ED=86=A0=EA=B8=80=EB=A9=B4=20=EB=90=98?= =?UTF-8?q?=EC=82=B4=EB=A6=AC=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/module/useModuleBasicSetting.js | 134 +++++++++++----------- 1 file changed, 68 insertions(+), 66 deletions(-) diff --git a/src/hooks/module/useModuleBasicSetting.js b/src/hooks/module/useModuleBasicSetting.js index e105f29b..b118f74b 100644 --- a/src/hooks/module/useModuleBasicSetting.js +++ b/src/hooks/module/useModuleBasicSetting.js @@ -65,8 +65,6 @@ export function useModuleBasicSetting(tabNum) { const common = moduleSelectionData.common const roofConstructions = moduleSelectionData.roofConstructions - console.log('moduleSelectionData', moduleSelectionData) - const listParams = roofConstructions.map((item) => { return { ...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) - 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 - setSurfaceShapePattern(roof, roofDisplay.column, true) //패턴 변경 - const offsetPoints = offsetPolygon(roof.points, offsetLength) //안쪽 offset - //모듈설치영역?? 생성 + const surfaceId = uuidv4() + let isNorth = false - const surfaceId = uuidv4() - let isNorth = false - - if (canvasSetting.roofSizeSet !== '3') { - //북면이 있지만 - if (roof.directionText && roof.directionText.indexOf('北') > -1) { - //북쪽일때 해당 서북서, 동북동은 제외한다고 한다 - if (!(roof.directionText.indexOf('西北西') > -1 || roof.directionText.indexOf('東北東') > -1)) { - isNorth = true + if (canvasSetting.roofSizeSet !== '3') { + //북면이 있지만 + if (roof.directionText && roof.directionText.indexOf('北') > -1) { + //북쪽일때 해당 서북서, 동북동은 제외한다고 한다 + 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 = []