가대 관련 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',
}
// 가대 관련 상수
export const TRESTLE_MATERIAL = {
EAVE_BAR: 'eaveBar',
HALF_EAVE_BAR: 'halfEaveBar',
RACK: 'rack',
SMART_RACK: 'smartRack',
BRACKET: 'bracket',
}
export const SAVE_KEY = [
'selectable',
'name',

View File

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