배치면 이동 시 화살표 위치 수정

This commit is contained in:
hyojun.choi 2026-04-13 10:35:12 +09:00
parent d15c9e69ec
commit 8eca824c8f

View File

@ -250,7 +250,7 @@ export function useRoofFn() {
const allRoofObject = canvas const allRoofObject = canvas
.getObjects() .getObjects()
.filter((obj) => obj !== roof && (obj.attributes?.roofId === roof.id || obj.parentId === roof.id || obj.parentId === wall.id)) .filter((obj) => obj !== roof && (obj.attributes?.roofId === roof.id || obj.parentId === roof.id || (wall && obj.parentId === wall.id)))
/** 지붕이 움직인 만큼의 delta를 구한다. */ /** 지붕이 움직인 만큼의 delta를 구한다. */
const originalRoofLeft = roof.left const originalRoofLeft = roof.left
@ -276,15 +276,33 @@ export function useRoofFn() {
// Move all related objects by the delta // Move all related objects by the delta
allRoofObject.forEach((obj) => { allRoofObject.forEach((obj) => {
if (obj.points !== undefined) { if (obj.points !== undefined) {
obj.set({ if (obj.name === 'arrow') {
left: obj.left + deltaX, // arrow 는 originX='left' 기본값이며 polygonMoved 가 left=pathOffset(중심) 으로
top: obj.top + deltaY, // 리셋하면 origin 불일치로 위치가 밀리므로, 단순 점 이동만 수행.
originX: 'center', obj.points = obj.points.map((p) => ({ x: p.x + deltaX, y: p.y + deltaY }))
originY: 'center', const dim = obj._calcDimensions({})
objectCaching: false, obj.set({
}) left: dim.left + dim.width / 2,
obj.fire('polygonMoved') top: dim.top + dim.height / 2,
obj.fire('modified') width: dim.width,
height: dim.height,
pathOffset: { x: dim.left + dim.width / 2, y: dim.top + dim.height / 2 },
originX: 'center',
originY: 'center',
objectCaching: false,
})
obj.setCoords()
} else {
obj.set({
left: obj.left + deltaX,
top: obj.top + deltaY,
originX: 'center',
originY: 'center',
objectCaching: false,
})
obj.fire('polygonMoved')
obj.fire('modified')
}
} else { } else {
obj.set({ obj.set({
left: obj.left + deltaX, left: obj.left + deltaX,