- 시작 입력 가능하도록 수정

This commit is contained in:
hyojun.choi 2025-02-07 14:32:49 +09:00
parent 0f633cb29c
commit 04e9bfd63b
2 changed files with 12 additions and 1 deletions

View File

@ -28,6 +28,14 @@ export const Orientation = forwardRef(({ tabNum }, ref) => {
}, [compasDeg]) }, [compasDeg])
const checkDegree = (e) => { const checkDegree = (e) => {
if (e === '-0' || e === '-') {
setCompasDeg('-')
return
}
if (e === '0-') {
setCompasDeg('-0')
return
}
if (Number(e) >= -180 && Number(e) <= 180) { if (Number(e) >= -180 && Number(e) <= 180) {
if (numberCheck(Number(e))) { if (numberCheck(Number(e))) {
setCompasDeg(Number(e)) setCompasDeg(Number(e))

View File

@ -23,10 +23,13 @@ export function useOrientation() {
}, []) }, [])
const nextStep = () => { const nextStep = () => {
if (isNaN(compasDeg)) {
setCompasDeg(0)
}
const roofs = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.ROOF) const roofs = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.ROOF)
roofs.forEach((roof) => { roofs.forEach((roof) => {
roof.set({ roof.set({
moduleCompass: compasDeg, moduleCompass: isNaN(compasDeg) ? 0 : compasDeg,
}) })
drawDirectionArrow(roof) drawDirectionArrow(roof)
}) })