가대 관련 item 상수화

This commit is contained in:
hyojun.choi 2025-02-27 10:09:06 +09:00
parent f51bbaa72f
commit 15c51547ce
2 changed files with 26 additions and 17 deletions

View File

@ -116,6 +116,15 @@ export const POLYGON_TYPE = {
OBJECT_SURFACE: 'objectOffset', OBJECT_SURFACE: 'objectOffset',
} }
// 가대 관련 상수
export const TRESTLE_MATERIAL = {
EAVE_BAR: 'eaveBar',
HALF_EAVE_BAR: 'halfEaveBar',
RACK: 'rack',
SMART_RACK: 'smartRack',
BRACKET: 'bracket',
}
export const SAVE_KEY = [ export const SAVE_KEY = [
'selectable', 'selectable',
'name', 'name',

View File

@ -1,6 +1,6 @@
import { useRecoilValue } from 'recoil' import { useRecoilValue } from 'recoil'
import { canvasState, currentAngleTypeSelector } from '@/store/canvasAtom' import { canvasState, currentAngleTypeSelector } from '@/store/canvasAtom'
import { POLYGON_TYPE } from '@/common/common' import { POLYGON_TYPE, TRESTLE_MATERIAL } from '@/common/common'
import { moduleSelectionDataState } from '@/store/selectedModuleOptions' import { moduleSelectionDataState } from '@/store/selectedModuleOptions'
import { getDegreeByChon } from '@/util/canvas-util' import { getDegreeByChon } from '@/util/canvas-util'
import { v4 as uuidv4 } from 'uuid' import { v4 as uuidv4 } from 'uuid'
@ -147,7 +147,7 @@ export const useTrestle = () => {
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,
name: 'eaveBar', name: TRESTLE_MATERIAL.EAVE_BAR,
stroke: 'blue', stroke: 'blue',
strokeWidth: 4, strokeWidth: 4,
selectable: false, selectable: false,
@ -178,7 +178,7 @@ export const useTrestle = () => {
if (!bottomPoints) return if (!bottomPoints) return
const halfEaveBar = new fabric.Line(barPoints, { const halfEaveBar = new fabric.Line(barPoints, {
parent: surface, parent: surface,
name: 'halfEaveBar', name: TRESTLE_MATERIAL.HALF_EAVE_BAR,
stroke: 'blue', stroke: 'blue',
strokeWidth: 4, strokeWidth: 4,
selectable: false, selectable: false,
@ -208,7 +208,7 @@ export const useTrestle = () => {
if (!bottomPoints) return if (!bottomPoints) return
const halfEaveBar = new fabric.Line(barPoints, { const halfEaveBar = new fabric.Line(barPoints, {
parent: surface, parent: surface,
name: 'halfEaveBar', name: TRESTLE_MATERIAL.HALF_EAVE_BAR,
stroke: 'blue', stroke: 'blue',
strokeWidth: 4, strokeWidth: 4,
selectable: false, selectable: false,
@ -1086,7 +1086,7 @@ export const useTrestle = () => {
rackLength = getTrestleLength(setRackTpLen, degree) / 10 rackLength = getTrestleLength(setRackTpLen, degree) / 10
if (setRackTpCd === 'RACK') { if (setRackTpCd === 'RACK') {
const rack = new fabric.Line([startPointX, startPointY, startPointX, startPointY - rackLength], { const rack = new fabric.Line([startPointX, startPointY, startPointX, startPointY - rackLength], {
name: 'smartRack', name: TRESTLE_MATERIAL.SMART_RACK,
stroke: 'red', stroke: 'red',
strokeWidth: 4, strokeWidth: 4,
selectable: true, selectable: true,
@ -1117,7 +1117,7 @@ export const useTrestle = () => {
}) })
} else { } else {
const rack = new fabric.Line([startPointX, startPointY, startPointX, startPointY - rackLength], { const rack = new fabric.Line([startPointX, startPointY, startPointX, startPointY - rackLength], {
name: 'rack', name: TRESTLE_MATERIAL.RACK,
stroke: 'red', stroke: 'red',
strokeWidth: 4, strokeWidth: 4,
selectable: false, selectable: false,
@ -1159,7 +1159,7 @@ export const useTrestle = () => {
rackLength = getTrestleLength(setRackTpLen, degree) / 10 rackLength = getTrestleLength(setRackTpLen, degree) / 10
if (setRackTpCd === 'RACK') { if (setRackTpCd === 'RACK') {
const rack = new fabric.Line([startPointX, startPointY, startPointX - rackLength, startPointY], { const rack = new fabric.Line([startPointX, startPointY, startPointX - rackLength, startPointY], {
name: 'smartRack', name: TRESTLE_MATERIAL.SMART_RACK,
stroke: 'red', stroke: 'red',
strokeWidth: 4, strokeWidth: 4,
selectable: false, selectable: false,
@ -1190,7 +1190,7 @@ export const useTrestle = () => {
}) })
} else { } else {
const rack = new fabric.Line([startPointX, startPointY, startPointX - rackLength, startPointY], { const rack = new fabric.Line([startPointX, startPointY, startPointX - rackLength, startPointY], {
name: 'rack', name: TRESTLE_MATERIAL.RACK,
stroke: 'red', stroke: 'red',
shadow: { shadow: {
color: 'black', // Outline color color: 'black', // Outline color
@ -1231,7 +1231,7 @@ export const useTrestle = () => {
rackLength = getTrestleLength(setRackTpLen, degree) / 10 rackLength = getTrestleLength(setRackTpLen, degree) / 10
if (setRackTpCd === 'RACK') { if (setRackTpCd === 'RACK') {
const rack = new fabric.Line([startPointX, startPointY, startPointX + rackLength, startPointY], { const rack = new fabric.Line([startPointX, startPointY, startPointX + rackLength, startPointY], {
name: 'smartRack', name: TRESTLE_MATERIAL.SMART_RACK,
stroke: 'red', stroke: 'red',
strokeWidth: 4, strokeWidth: 4,
selectable: false, selectable: false,
@ -1262,7 +1262,7 @@ export const useTrestle = () => {
}) })
} else { } else {
const rack = new fabric.Line([startPointX, startPointY, startPointX + rackLength, startPointY], { const rack = new fabric.Line([startPointX, startPointY, startPointX + rackLength, startPointY], {
name: 'rack', name: TRESTLE_MATERIAL.RACK,
stroke: 'red', stroke: 'red',
shadow: { shadow: {
color: 'black', // Outline color color: 'black', // Outline color
@ -1301,7 +1301,7 @@ export const useTrestle = () => {
rackLength = getTrestleLength(setRackTpLen, degree) / 10 rackLength = getTrestleLength(setRackTpLen, degree) / 10
if (setRackTpCd === 'RACK') { if (setRackTpCd === 'RACK') {
const rack = new fabric.Line([startPointX, startPointY, startPointX, startPointY + rackLength], { const rack = new fabric.Line([startPointX, startPointY, startPointX, startPointY + rackLength], {
name: 'smartRack', name: TRESTLE_MATERIAL.SMART_RACK,
stroke: 'red', stroke: 'red',
strokeWidth: 4, strokeWidth: 4,
selectable: false, selectable: false,
@ -1332,7 +1332,7 @@ export const useTrestle = () => {
}) })
} else { } else {
const rack = new fabric.Line([startPointX, startPointY, startPointX, startPointY + rackLength], { const rack = new fabric.Line([startPointX, startPointY, startPointX, startPointY + rackLength], {
name: 'rack', name: TRESTLE_MATERIAL.RACK,
stroke: 'red', stroke: 'red',
shadow: { shadow: {
color: 'black', // Outline color color: 'black', // Outline color
@ -1394,7 +1394,7 @@ export const useTrestle = () => {
left: x2 - bracketLength / 3, left: x2 - bracketLength / 3,
top: len, top: len,
fill: 'green', fill: 'green',
name: 'bracket', name: TRESTLE_MATERIAL.BRACKET,
parentId: rack.parentId, parentId: rack.parentId,
visible: isTrestleDisplay, visible: isTrestleDisplay,
surfaceId: surface.id, surfaceId: surface.id,
@ -1416,7 +1416,7 @@ export const useTrestle = () => {
left: len, left: len,
top: y2 - bracketLength / 3, top: y2 - bracketLength / 3,
fill: 'green', fill: 'green',
name: 'bracket', name: TRESTLE_MATERIAL.BRACKET,
parentId: rack.parentId, parentId: rack.parentId,
visible: isTrestleDisplay, visible: isTrestleDisplay,
surfaceId: surface.id, surfaceId: surface.id,
@ -1441,7 +1441,7 @@ export const useTrestle = () => {
parentId: rack.parentId, parentId: rack.parentId,
visible: isTrestleDisplay, visible: isTrestleDisplay,
surfaceId: surface.id, surfaceId: surface.id,
name: 'bracket', name: TRESTLE_MATERIAL.BRACKET,
width: bracketLength, width: bracketLength,
height: bracketLength, height: bracketLength,
selectable: false, selectable: false,
@ -1459,7 +1459,7 @@ export const useTrestle = () => {
left: x2 - bracketLength / 3, left: x2 - bracketLength / 3,
top: len, top: len,
fill: 'green', fill: 'green',
name: 'bracket', name: TRESTLE_MATERIAL.BRACKET,
parentId: rack.parentId, parentId: rack.parentId,
visible: isTrestleDisplay, visible: isTrestleDisplay,
surfaceId: surface.id, surfaceId: surface.id,
@ -1645,7 +1645,7 @@ export const useTrestle = () => {
left: startPointX - 5, left: startPointX - 5,
top: startPointY - 5, top: startPointY - 5,
fill: 'green', fill: 'green',
name: 'bracket', name: TRESTLE_MATERIAL.BRACKET,
parentId: module.id, parentId: module.id,
surfaceId: module.surfaceId, surfaceId: module.surfaceId,
width: 10, width: 10,