Merge pull request '회전 후 잘리는 현상 수정' (#547) from dev into dev-deploy

Reviewed-on: #547
This commit is contained in:
ysCha 2026-01-05 09:27:08 +09:00
commit b295142c20

View File

@ -1,6 +1,6 @@
'use client'
import { useRecoilValue, useResetRecoilState } from 'recoil'
import { useRecoilState, useRecoilValue, useResetRecoilState } from 'recoil'
import {
canvasSettingState,
canvasState,
@ -50,7 +50,7 @@ export function useSurfaceShapeBatch({ isHidden, setIsHidden }) {
const { changeCorridorDimensionText } = useText()
const currentCanvasPlan = useRecoilValue(currentCanvasPlanState)
const { fetchSettings } = useCanvasSetting(false)
const currentObject = useRecoilValue(currentObjectState)
const [currentObject, setCurrentObject] = useRecoilState(currentObjectState)
const [popupId, setPopupId] = useState(uuidv4())
const applySurfaceShape = (surfaceRefs, selectedType, id) => {
@ -1525,6 +1525,7 @@ export function useSurfaceShapeBatch({ isHidden, setIsHidden }) {
// 개별 객체들을 다시 캔버스에 추가하고 처리
group.getObjects().forEach((obj) => {
canvas.add(obj)
obj.dirty = true // 캐시 무효화
obj.setCoords()
// currentObject인 경우 추가 처리
@ -1535,6 +1536,8 @@ export function useSurfaceShapeBatch({ isHidden, setIsHidden }) {
// QPolygon 내부 구조 재구성 (선이 깨지는 문제 해결)
if (obj.type === 'QPolygon' && obj.lines) {
obj.initLines()
obj.dirty = true
obj.setCoords()
}
obj.set({
@ -1545,6 +1548,8 @@ export function useSurfaceShapeBatch({ isHidden, setIsHidden }) {
// relatedObject인 경우에도 필요한 처리
if (obj.type === 'QPolygon' && obj.lines) {
obj.initLines()
obj.dirty = true
obj.setCoords()
}
if (obj.type === 'group') {
// 회전 후의 points를 groupPoints로 업데이트
@ -1552,24 +1557,30 @@ export function useSurfaceShapeBatch({ isHidden, setIsHidden }) {
obj.recalculateGroupPoints()
obj._objects?.forEach((obj) => {
obj.initLines()
obj.fire('modified')
obj._objects?.forEach((innerObj) => {
innerObj.initLines()
innerObj.dirty = true
innerObj.setCoords()
innerObj.fire('modified')
})
}
}
})
currentObject.dirty = true
currentObject.setCoords()
currentObject.fire('modified')
currentObject.fire('polygonMoved')
// 화살표와 선 다시 그리기
drawDirectionArrow(currentObject)
setTimeout(() => {
setPolygonLinesActualSize(currentObject)
changeSurfaceLineType(currentObject)
currentObject.dirty = true
currentObject.setCoords()
canvas.requestRenderAll()
setCurrentObject(currentObject)
}, 500)
// currentObject를 다시 선택 상태로 설정
canvas.setActiveObject(currentObject)
canvas.renderAll()
}
}