From d0b75f27fba0d4d6d2b3b53f38abaa50005b60b6 Mon Sep 17 00:00:00 2001 From: "hyojun.choi" Date: Fri, 4 Jul 2025 14:12:53 +0900 Subject: [PATCH] =?UTF-8?q?[1142]=20:=20=E3=80=90HANASYS=20DESIGN=E3=80=91?= =?UTF-8?q?=E6=96=B9=E4=BD=8D=E9=81=B8=E6=8A=9E=E6=99=82=E3=81=AE+,-?= =?UTF-8?q?=E3=81=AE=E8=A1=A8=E8=A8=98=E3=81=8C=E7=95=B0=E3=81=AA=E3=82=8B?= =?UTF-8?q?=20=EB=AA=A8=EB=93=88/=EA=B0=80=EB=8C=80=20=EC=84=A0=ED=83=9D?= =?UTF-8?q?=20=EB=B0=A9=EC=9C=84=EC=9D=98=20+,=20-=20=ED=91=9C=EA=B8=B0?= =?UTF-8?q?=EB=A5=BC=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modal/basic/step/Orientation.jsx | 14 ++-- .../flowDirection/FlowDirectionSetting.jsx | 67 ++++++++++++++----- src/hooks/usePolygon.js | 40 +++++------ 3 files changed, 77 insertions(+), 44 deletions(-) diff --git a/src/components/floor-plan/modal/basic/step/Orientation.jsx b/src/components/floor-plan/modal/basic/step/Orientation.jsx index 17cd2e88..d815bd2c 100644 --- a/src/components/floor-plan/modal/basic/step/Orientation.jsx +++ b/src/components/floor-plan/modal/basic/step/Orientation.jsx @@ -275,31 +275,31 @@ export const Orientation = forwardRef((props, ref) => { {Array.from({ length: 180 / 15 }).map((dot, index) => (
= 172 && index === 0 && inputCompasDeg <= 180) || (inputCompasDeg === -180 && index === 0) ? 'act' : ''}`} + className={`circle ${getDegreeInOrientation(inputCompasDeg) === -15 * index + 180 || (index === 0 && inputCompasDeg >= 172 && index === 0 && inputCompasDeg <= 180) || (inputCompasDeg === -180 && index === 0) ? 'act' : ''}`} onClick={() => { if (index === 0) { setInputCompasDeg(180) return } - setInputCompasDeg(-1 * (-15 * index + 180)) + setInputCompasDeg(-15 * index + 180) }} > {index === 0 && 180°} - {index === 6 && -90°} + {index === 6 && 90°}
))} {Array.from({ length: 180 / 15 }).map((dot, index) => (
setInputCompasDeg(15 * index)} + className={`circle ${inputCompasDeg !== 180 && getDegreeInOrientation(inputCompasDeg) === -1 * 15 * index ? 'act' : ''}`} + onClick={() => setInputCompasDeg(15 * index * -1)} > {index === 0 && } - {index === 6 && 90°} + {index === 6 && -90°}
))}
-
+
diff --git a/src/components/floor-plan/modal/flowDirection/FlowDirectionSetting.jsx b/src/components/floor-plan/modal/flowDirection/FlowDirectionSetting.jsx index 673e4bd9..a84efccf 100644 --- a/src/components/floor-plan/modal/flowDirection/FlowDirectionSetting.jsx +++ b/src/components/floor-plan/modal/flowDirection/FlowDirectionSetting.jsx @@ -32,15 +32,40 @@ export default function FlowDirectionSetting(props) { const [flowDirection, setFlowDirection] = useState(target.direction) const { closePopup } = usePopup() + useEffect(() => { + let newCompassDeg = 0 + if ([-15, 0, 15].includes(compasDeg)) { + newCompassDeg = 0 + } else if ([30, 45, 60].includes(compasDeg)) { + newCompassDeg = 45 + } else if ([75, 90, 105].includes(compasDeg)) { + newCompassDeg = 90 + } else if ([120, 135, 150].includes(compasDeg)) { + newCompassDeg = 135 + } else if ([165, 180, -165].includes(compasDeg)) { + newCompassDeg = 180 + } else if ([-120, -135, -150].includes(compasDeg)) { + newCompassDeg = -135 + } else if ([-105, -90, -75].includes(compasDeg)) { + newCompassDeg = -90 + } else if ([-60, -45, -30].includes(compasDeg)) { + newCompassDeg = -45 + } else { + newCompassDeg = '' + } + const newOrientation = orientations.find((item) => item.value === newCompassDeg) + setSelectedOrientation(newOrientation) + }, [compasDeg]) + const orientations = [ - { name: `${getMessage('commons.none')}`, value: 0 }, - { name: `${getMessage('commons.south')}`, value: 360 }, - { name: `${getMessage('commons.south')}${getMessage('commons.east')}`, value: 315 }, - { name: `${getMessage('commons.south')}${getMessage('commons.west')}`, value: 45 }, - { name: `${getMessage('commons.east')}`, value: 270 }, - { name: `${getMessage('commons.west')}`, value: 90 }, - { name: `${getMessage('commons.north')}${getMessage('commons.east')}`, value: 225 }, - { name: `${getMessage('commons.north')}${getMessage('commons.west')}`, value: 135 }, + { name: `${getMessage('commons.none')}`, value: '' }, + { name: `${getMessage('commons.south')}`, value: 0 }, + { name: `${getMessage('commons.south')}${getMessage('commons.east')}`, value: 45 }, + { name: `${getMessage('commons.south')}${getMessage('commons.west')}`, value: -45 }, + { name: `${getMessage('commons.east')}`, value: 90 }, + { name: `${getMessage('commons.west')}`, value: -90 }, + { name: `${getMessage('commons.north')}${getMessage('commons.east')}`, value: 135 }, + { name: `${getMessage('commons.north')}${getMessage('commons.west')}`, value: -135 }, { name: `${getMessage('commons.north')}`, value: 180 }, ] @@ -109,6 +134,11 @@ export default function FlowDirectionSetting(props) { value={selectedOrientation} options={orientations} onChange={(e) => { + if (e.value === '') { + setCompasDeg(null) + setSelectedOrientation(e) + return + } setType(FLOW_DIRECTION_TYPE.EIGHT_AZIMUTH) setSelectedOrientation(e) setCompasDeg(e.value) @@ -137,31 +167,32 @@ export default function FlowDirectionSetting(props) {
- {Array.from({ length: 180 / 15 + 1 }).map((dot, index) => ( + {Array.from({ length: 180 / 15 }).map((dot, index) => (
{ + if (index === 0) { + setCompasDeg(180) + return + } setType(FLOW_DIRECTION_TYPE.TWENTY_FOUR_AZIMUTH) - setCompasDeg(15 * (12 + index)) + setCompasDeg(-15 * index + 180) }} >
))} - {Array.from({ length: 180 / 15 - 1 }).map((dot, index) => ( + {Array.from({ length: 180 / 15 }).map((dot, index) => (
{ setType(FLOW_DIRECTION_TYPE.TWENTY_FOUR_AZIMUTH) - setCompasDeg(15 * (index + 1)) + setCompasDeg(15 * index * -1) }} >
))}
-
+
diff --git a/src/hooks/usePolygon.js b/src/hooks/usePolygon.js index 9f0e390e..84f8e9bf 100644 --- a/src/hooks/usePolygon.js +++ b/src/hooks/usePolygon.js @@ -345,7 +345,7 @@ export const usePolygon = () => { //arrow의 compass 값으로 방향 글자 설정 필요 const drawDirectionStringToArrow2 = (polygon, showDirectionText) => { - const { direction, surfaceCompass, moduleCompass, arrow } = polygon + let { direction, surfaceCompass, moduleCompass, arrow } = polygon if (moduleCompass === null || moduleCompass === undefined) { const textObj = new fabric.Text(`${currentAngleType === ANGLE_TYPE.SLOPE ? arrow.pitch : getDegreeByChon(arrow.pitch)}${pitchText}`, { fontFamily: flowFontOptions.fontFamily.value, @@ -371,7 +371,9 @@ export const usePolygon = () => { let text = '' - let compassType = (375 - getDegreeInOrientation(moduleCompass)) / 15 + let compassType = (375 + getDegreeInOrientation(moduleCompass)) / 15 + + moduleCompass = -1 * moduleCompass if (moduleCompass === 0 || (moduleCompass < 0 && moduleCompass >= -6)) { compassType = 1 @@ -397,7 +399,7 @@ export const usePolygon = () => { compassType = 11 } else if (moduleCompass < 0 && moduleCompass >= -171) { compassType = 12 - } else if (moduleCompass === 180) { + } else if (Math.abs(moduleCompass) === 180) { compassType = 13 } @@ -432,7 +434,7 @@ export const usePolygon = () => { ? (text = '北北東') : (text = '南南西') } else if ([10].includes(compassType)) { - direction === 'north' ? (text = '南東') : direction === 'south' ? (text = '北西') : direction === 'west' ? (text = '南西') : (text = '北東') + direction === 'north' ? (text = '南東') : direction === 'south' ? (text = '北西') : direction === 'west' ? (text = '北東') : (text = '南西') } else if ([11, 12].includes(compassType)) { direction === 'north' ? (text = '南南東') @@ -484,37 +486,37 @@ export const usePolygon = () => { } // 東,西,南,北 - if ([360].includes(surfaceCompass)) { + if ([0].includes(surfaceCompass)) { text = '南' - } else if ([345, 330].includes(surfaceCompass)) { + } else if ([15, 30].includes(surfaceCompass)) { text = '南南東' - } else if ([315].includes(surfaceCompass)) { + } else if ([45].includes(surfaceCompass)) { text = '南東' - } else if ([300, 285].includes(surfaceCompass)) { + } else if ([60, 75].includes(surfaceCompass)) { text = '東南東' - } else if ([270].includes(surfaceCompass)) { + } else if ([90].includes(surfaceCompass)) { text = '東' - } else if ([255, 240].includes(surfaceCompass)) { + } else if ([105, 120].includes(surfaceCompass)) { text = '東北東' - } else if ([225].includes(surfaceCompass)) { + } else if ([135].includes(surfaceCompass)) { text = '北東' - } else if ([210, 195].includes(surfaceCompass)) { + } else if ([150, 165].includes(surfaceCompass)) { text = '北北東' } else if ([180].includes(surfaceCompass)) { text = '北' - } else if ([165, 150].includes(surfaceCompass)) { + } else if ([-165, -150].includes(surfaceCompass)) { text = '北北西' - } else if ([135].includes(surfaceCompass)) { + } else if ([-135].includes(surfaceCompass)) { text = '北西' - } else if ([120, 105].includes(surfaceCompass)) { + } else if ([-120, -105].includes(surfaceCompass)) { text = '西北西' - } else if ([90].includes(surfaceCompass)) { + } else if ([-90].includes(surfaceCompass)) { text = '西' - } else if ([75, 60].includes(surfaceCompass)) { + } else if ([-75, -60].includes(surfaceCompass)) { text = '西南西' - } else if ([45].includes(surfaceCompass)) { + } else if ([-45].includes(surfaceCompass)) { text = '西南' - } else if ([30, 15].includes(surfaceCompass)) { + } else if ([-30, -15].includes(surfaceCompass)) { text = '西西南' }