From c06216bdb20807189e471916472e2e07305fa5f5 Mon Sep 17 00:00:00 2001 From: "hyojun.choi" Date: Fri, 13 Sep 2024 09:53:57 +0900 Subject: [PATCH] =?UTF-8?q?=EC=99=B8=EB=B2=BD=EC=84=A0=20=ED=99=95?= =?UTF-8?q?=EC=A0=95=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modal/outerlinesetting/OuterLineWall.jsx | 28 ++++++++++++++++--- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/src/components/floor-plan/modal/outerlinesetting/OuterLineWall.jsx b/src/components/floor-plan/modal/outerlinesetting/OuterLineWall.jsx index c5bd5686..b743b6fe 100644 --- a/src/components/floor-plan/modal/outerlinesetting/OuterLineWall.jsx +++ b/src/components/floor-plan/modal/outerlinesetting/OuterLineWall.jsx @@ -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 (