복사 후 문제 수정

This commit is contained in:
hyojun.choi 2025-12-05 15:36:56 +09:00
parent eee74edf9e
commit 28d26511de

View File

@ -648,6 +648,7 @@ export function useCommonUtils() {
lockMovementY: true, lockMovementY: true,
name: obj.name, name: obj.name,
editable: false, editable: false,
selectable: true, // 복사된 객체 선택 가능하도록 설정
id: uuidv4(), //복사된 객체라 새로 따준다 id: uuidv4(), //복사된 객체라 새로 따준다
}) })
@ -656,19 +657,25 @@ export function useCommonUtils() {
//배치면일 경우 //배치면일 경우
if (obj.name === 'roof') { if (obj.name === 'roof') {
clonedObj.setCoords() clonedObj.canvas = canvas // canvas 참조 설정
clonedObj.fire('modified')
// clonedObj.fire('polygonMoved')
clonedObj.set({ clonedObj.set({
direction: obj.direction, direction: obj.direction,
directionText: obj.directionText, directionText: obj.directionText,
roofMaterial: obj.roofMaterial, roofMaterial: obj.roofMaterial,
stroke: 'black', // 복사된 객체는 선택 해제 상태의 색상으로 설정
selectable: true, // 선택 가능하도록 설정
evented: true, // 마우스 이벤트를 받을 수 있도록 설정
isFixed: false, // containsPoint에서 특별 처리 방지
}) })
obj.lines.forEach((line, index) => { obj.lines.forEach((line, index) => {
clonedObj.lines[index].set({ attributes: line.attributes }) clonedObj.lines[index].set({ attributes: line.attributes })
}) })
clonedObj.fire('polygonMoved') // 내부 좌표 재계산 (points, pathOffset)
clonedObj.fire('modified')
clonedObj.setCoords() // 모든 속성 설정 후 좌표 업데이트
canvas.setActiveObject(clonedObj)
canvas.renderAll() canvas.renderAll()
addLengthText(clonedObj) //수치 추가 addLengthText(clonedObj) //수치 추가
drawDirectionArrow(clonedObj) //방향 화살표 추가 drawDirectionArrow(clonedObj) //방향 화살표 추가