가대 설치 후 빽 할 경우 기존 가대관련 데이터 지우기
This commit is contained in:
parent
a2237de250
commit
679d9f8a32
@ -177,6 +177,7 @@ export const SAVE_KEY = [
|
|||||||
'moduleRowsTotCnt',
|
'moduleRowsTotCnt',
|
||||||
'seq',
|
'seq',
|
||||||
'smartRackId',
|
'smartRackId',
|
||||||
|
'directionText',
|
||||||
'quotationParam',
|
'quotationParam',
|
||||||
'pcses',
|
'pcses',
|
||||||
]
|
]
|
||||||
|
|||||||
@ -28,8 +28,10 @@ export const Orientation = forwardRef(({ tabNum }, ref) => {
|
|||||||
}, [compasDeg])
|
}, [compasDeg])
|
||||||
|
|
||||||
const checkDegree = (e) => {
|
const checkDegree = (e) => {
|
||||||
if (numberCheck(Number(e)) && Number(e) >= -180 && Number(e) <= 180) {
|
if (Number(e) >= -180 && Number(e) <= 180) {
|
||||||
setCompasDeg(Number(e))
|
if (numberCheck(Number(e))) {
|
||||||
|
setCompasDeg(Number(e))
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
setCompasDeg(compasDeg)
|
setCompasDeg(compasDeg)
|
||||||
}
|
}
|
||||||
@ -46,8 +48,8 @@ export const Orientation = forwardRef(({ tabNum }, ref) => {
|
|||||||
{Array.from({ length: 180 / 15 }).map((dot, index) => (
|
{Array.from({ length: 180 / 15 }).map((dot, index) => (
|
||||||
<div
|
<div
|
||||||
key={index}
|
key={index}
|
||||||
className={`circle ${getDegreeInOrientation(compasDeg) === 15 * (12 + index) ? 'act' : ''}`}
|
className={`circle ${getDegreeInOrientation(compasDeg) === -1 * (-15 * index + 180) ? 'act' : ''}`}
|
||||||
onClick={() => setCompasDeg(15 * (12 + index))}
|
onClick={() => setCompasDeg(-1 * (-15 * index + 180))}
|
||||||
>
|
>
|
||||||
{index === 0 && <i>180°</i>}
|
{index === 0 && <i>180°</i>}
|
||||||
{index === 6 && <i>-90°</i>}
|
{index === 6 && <i>-90°</i>}
|
||||||
|
|||||||
@ -19,6 +19,7 @@ import { useSurfaceShapeBatch } from '@/hooks/surface/useSurfaceShapeBatch'
|
|||||||
import { useRecoilValue } from 'recoil'
|
import { useRecoilValue } from 'recoil'
|
||||||
import { currentMenuState } from '@/store/canvasAtom'
|
import { currentMenuState } from '@/store/canvasAtom'
|
||||||
import { MENU } from '@/common/common'
|
import { MENU } from '@/common/common'
|
||||||
|
import { useTrestle } from '@/hooks/module/useTrestle'
|
||||||
|
|
||||||
export default function useMenu() {
|
export default function useMenu() {
|
||||||
const menus = []
|
const menus = []
|
||||||
@ -26,6 +27,7 @@ export default function useMenu() {
|
|||||||
const [popupId, setPopupId] = useState(uuidv4())
|
const [popupId, setPopupId] = useState(uuidv4())
|
||||||
const { addPopup } = usePopup()
|
const { addPopup } = usePopup()
|
||||||
const { deleteAllSurfacesAndObjects } = useSurfaceShapeBatch({})
|
const { deleteAllSurfacesAndObjects } = useSurfaceShapeBatch({})
|
||||||
|
const { clear: trestleClear } = useTrestle()
|
||||||
const handleMenu = (type) => {
|
const handleMenu = (type) => {
|
||||||
if (type === 'outline') {
|
if (type === 'outline') {
|
||||||
switch (currentMenu) {
|
switch (currentMenu) {
|
||||||
@ -79,6 +81,7 @@ export default function useMenu() {
|
|||||||
if (type === 'module') {
|
if (type === 'module') {
|
||||||
switch (currentMenu) {
|
switch (currentMenu) {
|
||||||
case MENU.MODULE_CIRCUIT_SETTING.BASIC_SETTING:
|
case MENU.MODULE_CIRCUIT_SETTING.BASIC_SETTING:
|
||||||
|
trestleClear()
|
||||||
addPopup(popupId, 1, <BasicSetting id={popupId} />)
|
addPopup(popupId, 1, <BasicSetting id={popupId} />)
|
||||||
break
|
break
|
||||||
case MENU.MODULE_CIRCUIT_SETTING.CIRCUIT_TRESTLE_SETTING:
|
case MENU.MODULE_CIRCUIT_SETTING.CIRCUIT_TRESTLE_SETTING:
|
||||||
|
|||||||
@ -1882,5 +1882,13 @@ export const useTrestle = () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return { apply, getTrestleParams }
|
const clear = () => {
|
||||||
|
canvas.getObjects().forEach((obj) => {
|
||||||
|
if (obj.name === 'eaveBar' || obj.name === 'rack' || obj.name === 'halfEaveBar' || obj.name === 'smartRack') {
|
||||||
|
canvas.remove(obj)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
return { apply, getTrestleParams, clear }
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,7 +13,7 @@ export function useTempGrid() {
|
|||||||
//임의 그리드 모드일 경우
|
//임의 그리드 모드일 경우
|
||||||
let pointer = canvas.getPointer(e.e)
|
let pointer = canvas.getPointer(e.e)
|
||||||
|
|
||||||
const tempGrid = new fabric.Line([pointer.x, 0, pointer.x, canvas.height], {
|
const tempGrid = new fabric.Line([pointer.x, -1500, pointer.x, 2500], {
|
||||||
stroke: gridColor,
|
stroke: gridColor,
|
||||||
strokeWidth: 1,
|
strokeWidth: 1,
|
||||||
selectable: true,
|
selectable: true,
|
||||||
@ -41,7 +41,7 @@ export function useTempGrid() {
|
|||||||
//임의 그리드 모드일 경우
|
//임의 그리드 모드일 경우
|
||||||
let pointer = { x: e.offsetX, y: e.offsetY }
|
let pointer = { x: e.offsetX, y: e.offsetY }
|
||||||
|
|
||||||
const tempGrid = new fabric.Line([0, pointer.y, canvas.width, pointer.y], {
|
const tempGrid = new fabric.Line([-1500, pointer.y, 2500, pointer.y], {
|
||||||
stroke: gridColor,
|
stroke: gridColor,
|
||||||
strokeWidth: 1,
|
strokeWidth: 1,
|
||||||
selectable: true,
|
selectable: true,
|
||||||
|
|||||||
@ -957,7 +957,7 @@ export const getAllRelatedObjects = (id, canvas) => {
|
|||||||
|
|
||||||
// 모듈,회로 구성에서 사용하는 degree 범위 별 값
|
// 모듈,회로 구성에서 사용하는 degree 범위 별 값
|
||||||
export const getDegreeInOrientation = (degree) => {
|
export const getDegreeInOrientation = (degree) => {
|
||||||
if (degree >= 352) {
|
if (degree >= 180 || degree < -180) {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
if (degree % 15 === 0) return degree
|
if (degree % 15 === 0) return degree
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user