외벽선 확정 추가

This commit is contained in:
hyojun.choi 2024-09-13 09:53:57 +09:00
parent bccca5f817
commit c06216bdb2

View File

@ -99,15 +99,16 @@ export default function OuterLineWall() {
if (idx === 0) {
return
}
drawLine(points[idx - 1], point)
drawLine(points[idx - 1], point, idx)
})
}
}, [points])
const drawLine = (point1, point2) => {
const drawLine = (point1, point2, idx) => {
const line = new QLine([point1.x, point1.y, point2.x, point2.y], {
stroke: 'black',
strokeWidth: 1,
idx: idx,
selectable: false,
name: 'outerLine',
})
@ -120,7 +121,6 @@ export default function OuterLineWall() {
const checkRightAngle = () => {
const length1Num = Number(length1Ref.current.value) / 10
const length2Num = Number(length2Ref.current.value) / 10
console.log(length1Num, length2Num, arrow1Ref.current, arrow2Ref.current)
if (points.length === 0) {
return
@ -258,6 +258,7 @@ export default function OuterLineWall() {
if (activeElem === length1Ref.current) {
setArrow1('↓')
arrow1Ref.current = '↓'
length2Ref.current.focus()
} else if (activeElem === length2Ref.current) {
if (arrow1Ref.current === '↓' || arrow1Ref.current === '↑') {
break
@ -274,6 +275,7 @@ export default function OuterLineWall() {
if (activeElem === length1Ref.current) {
setArrow1('↑')
arrow1Ref.current = '↑'
length2Ref.current.focus()
} else if (activeElem === length2Ref.current) {
if (arrow1Ref.current === '↓' || arrow1Ref.current === '↑') {
break
@ -289,6 +291,7 @@ export default function OuterLineWall() {
if (activeElem === length1Ref.current) {
setArrow1('←')
arrow1Ref.current = '←'
length2Ref.current.focus()
} else if (activeElem === length2Ref.current) {
if (arrow1Ref.current === '←' || arrow1Ref.current === '→') {
break
@ -304,6 +307,7 @@ export default function OuterLineWall() {
if (activeElem === length1Ref.current) {
setArrow1('→')
arrow1Ref.current = '→'
length2Ref.current.focus()
} else if (activeElem === length2Ref.current) {
if (arrow1Ref.current === '←' || arrow1Ref.current === '→') {
break
@ -316,6 +320,15 @@ export default function OuterLineWall() {
break
}
},
leeGubae: (e) => {
console.log('leegubae')
},
angle: (e) => {
console.log('angle')
},
diagonalLine: (e) => {
console.log('diagonalLine')
},
}
/**
@ -330,7 +343,14 @@ export default function OuterLineWall() {
setModalOption({ ...modalOption, outerwall: false })
}
const handleFix = () => {}
const handleFix = () => {
setPoints((prev) => {
if (prev.length === 0) {
return []
}
return [...prev, { x: prev[0].x, y: prev[0].y }]
})
}
return (
<WithDraggable isShow={true}>
<div className={`modal-pop-wrap ssm ${modalOption.outerwall ? 'mount' : ''} `}>