useCanvas 호출 제거

This commit is contained in:
hyojun.choi 2025-02-07 21:03:53 +09:00
parent aa7bdf595f
commit 2bbfa53400
2 changed files with 13 additions and 4 deletions

View File

@ -11,7 +11,6 @@ import { POLYGON_TYPE } from '@/common/common'
*/ */
export function useImgLoader() { export function useImgLoader() {
const canvas = useRecoilValue(canvasState) const canvas = useRecoilValue(canvasState)
const { removeMouseLines } = useCanvas()
const { currentCanvasPlan } = usePlan() const { currentCanvasPlan } = usePlan()
const { post } = useAxios() const { post } = useAxios()
@ -66,5 +65,16 @@ export function useImgLoader() {
console.log('🚀 ~ handleCanvasToPng ~ res:', res) console.log('🚀 ~ handleCanvasToPng ~ res:', res)
} }
/**
* 마우스 포인터의 가이드라인을 제거합니다.
*/
const removeMouseLines = () => {
if (canvas?._objects.length > 0) {
const mouseLines = canvas?._objects.filter((obj) => obj.name === 'mouseLine')
mouseLines.forEach((item) => canvas?.remove(item))
}
canvas?.renderAll()
}
return { handleCanvasToPng } return { handleCanvasToPng }
} }

View File

@ -80,7 +80,6 @@ export const useTrestle = () => {
const modules = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.MODULE) const modules = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.MODULE)
modules.forEach((module) => { modules.forEach((module) => {
module.fire('polygonMoved')
const { x, y } = module.getCenterPoint() const { x, y } = module.getCenterPoint()
const isExposedBottom = result.exposedBottomPoints.some((point) => Math.abs(point.x - x) < 2 && Math.abs(point.y - y) < 2) const isExposedBottom = result.exposedBottomPoints.some((point) => Math.abs(point.x - x) < 2 && Math.abs(point.y - y) < 2)
const isLeftExposedHalfBottom = result.leftExposedHalfBottomPoints.some((point) => Math.abs(point.x - x) < 2 && Math.abs(point.y - y) < 2) const isLeftExposedHalfBottom = result.leftExposedHalfBottomPoints.some((point) => Math.abs(point.x - x) < 2 && Math.abs(point.y - y) < 2)
@ -130,7 +129,7 @@ export const useTrestle = () => {
// 처마력바설치 true인 경우 설치 // 처마력바설치 true인 경우 설치
exposedBottomModules.forEach((module) => { exposedBottomModules.forEach((module) => {
//TODO : 방향별로 처마력바 설치해야함 //TODO : 방향별로 처마력바 설치해야함
const bottomPoints = findTopTwoPoints([...module.points], direction) const bottomPoints = findTopTwoPoints([...module.getCurrentPoints()], direction)
if (!bottomPoints) return if (!bottomPoints) return
const eaveBar = new fabric.Line([bottomPoints[0].x, bottomPoints[0].y, bottomPoints[1].x, bottomPoints[1].y], { const eaveBar = new fabric.Line([bottomPoints[0].x, bottomPoints[0].y, bottomPoints[1].x, bottomPoints[1].y], {
parent: surface, parent: surface,
@ -148,7 +147,7 @@ export const useTrestle = () => {
if (isChidory && cvrPlvrYn === 'Y') { if (isChidory && cvrPlvrYn === 'Y') {
leftExposedHalfBottomModules.forEach((module) => { leftExposedHalfBottomModules.forEach((module) => {
const bottomPoints = findTopTwoPoints([...module.points], direction) const bottomPoints = findTopTwoPoints([...module.getCurrentPoints()], direction)
let barPoints = [] let barPoints = []
//설치해야할 반처마커버 포인트를 방향에 따라 설정 //설치해야할 반처마커버 포인트를 방향에 따라 설정