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