보조선 수동 작성 시 roofId 추가
This commit is contained in:
parent
451f742b0f
commit
381af987f6
@ -1,8 +1,13 @@
|
|||||||
import { useMessage } from '@/hooks/useMessage'
|
import { useMessage } from '@/hooks/useMessage'
|
||||||
import WithDraggable from '@/components/common/draggable/WithDraggable'
|
import WithDraggable from '@/components/common/draggable/WithDraggable'
|
||||||
|
import { globalPitchState } from '@/store/canvasAtom'
|
||||||
|
import { useRecoilState } from 'recoil'
|
||||||
|
import { useRef } from 'react'
|
||||||
|
|
||||||
export default function Slope({ setShowSlopeSettingModal }) {
|
export default function Slope({ setShowSlopeSettingModal }) {
|
||||||
const { getMessage } = useMessage()
|
const { getMessage } = useMessage()
|
||||||
|
const [globalPitch, setGlobalPitch] = useRecoilState(globalPitchState)
|
||||||
|
const inputRef = useRef()
|
||||||
return (
|
return (
|
||||||
<WithDraggable isShow={true} pos={{ x: 50, y: -950 }}>
|
<WithDraggable isShow={true} pos={{ x: 50, y: -950 }}>
|
||||||
<div className={`modal-pop-wrap xxxm`}>
|
<div className={`modal-pop-wrap xxxm`}>
|
||||||
@ -19,13 +24,21 @@ export default function Slope({ setShowSlopeSettingModal }) {
|
|||||||
{getMessage('slope')}
|
{getMessage('slope')}
|
||||||
</span>
|
</span>
|
||||||
<div className="input-grid mr5">
|
<div className="input-grid mr5">
|
||||||
<input type="text" className="input-origin block" defaultValue={300} />
|
<input type="text" className="input-origin block" defaultValue={globalPitch} ref={inputRef} />
|
||||||
</div>
|
</div>
|
||||||
<span className="thin">{getMessage('size.angle')}</span>
|
<span className="thin">{getMessage('size.angle')}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="grid-btn-wrap">
|
<div className="grid-btn-wrap">
|
||||||
<button className="btn-frame modal act">{getMessage('modal.common.save')}</button>
|
<button
|
||||||
|
className="btn-frame modal act"
|
||||||
|
onClick={() => {
|
||||||
|
setGlobalPitch(inputRef.current.value)
|
||||||
|
setShowSlopeSettingModal(false)
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{getMessage('modal.common.save')}
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -607,10 +607,15 @@ export function useAuxiliaryDrawing(setShowAuxiliaryModal) {
|
|||||||
* 일변전으로 돌아가기
|
* 일변전으로 돌아가기
|
||||||
*/
|
*/
|
||||||
const handleRollback = () => {
|
const handleRollback = () => {
|
||||||
const lastLine = lineHistory.current.pop()
|
const innerPoint = canvas.getObjects().find((obj) => obj.name === 'innerPoint')
|
||||||
mousePointerArr.current = []
|
if (innerPoint) {
|
||||||
canvas.remove(...canvas.getObjects().filter((obj) => obj.name === 'innerPoint'))
|
mousePointerArr.current = []
|
||||||
|
canvas.remove(innerPoint)
|
||||||
|
canvas.renderAll()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const lastLine = lineHistory.current.pop()
|
||||||
if (lastLine) {
|
if (lastLine) {
|
||||||
roofAdsorptionPoints.current = roofAdsorptionPoints.current.filter(
|
roofAdsorptionPoints.current = roofAdsorptionPoints.current.filter(
|
||||||
(point) => point.x !== lastLine.intersectionPoint?.x && point.y !== lastLine.intersectionPoint?.y,
|
(point) => point.x !== lastLine.intersectionPoint?.x && point.y !== lastLine.intersectionPoint?.y,
|
||||||
@ -640,6 +645,7 @@ export function useAuxiliaryDrawing(setShowAuxiliaryModal) {
|
|||||||
const inPolygon2 = booleanPointInPolygon([line.x2, line.y2], turfPolygon)
|
const inPolygon2 = booleanPointInPolygon([line.x2, line.y2], turfPolygon)
|
||||||
|
|
||||||
if (inPolygon1 && inPolygon2) {
|
if (inPolygon1 && inPolygon2) {
|
||||||
|
line.attributes = { ...line.attributes, roofId: roofBase.id }
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@ -34,8 +34,14 @@ import { QLine } from '@/components/fabric/QLine'
|
|||||||
//외벽선 그리기
|
//외벽선 그리기
|
||||||
export function useOuterLineWall(setShowOutlineModal) {
|
export function useOuterLineWall(setShowOutlineModal) {
|
||||||
const canvas = useRecoilValue(canvasState)
|
const canvas = useRecoilValue(canvasState)
|
||||||
const { addCanvasMouseEventListener, addDocumentEventListener, removeAllMouseEventListeners, removeAllDocumentEventListeners, removeMouseEvent } =
|
const {
|
||||||
useEvent()
|
initEvent,
|
||||||
|
addCanvasMouseEventListener,
|
||||||
|
addDocumentEventListener,
|
||||||
|
removeAllMouseEventListeners,
|
||||||
|
removeAllDocumentEventListeners,
|
||||||
|
removeMouseEvent,
|
||||||
|
} = useEvent()
|
||||||
const { getIntersectMousePoint } = useMouse()
|
const { getIntersectMousePoint } = useMouse()
|
||||||
const { addLine, removeLine } = useLine()
|
const { addLine, removeLine } = useLine()
|
||||||
const { tempGridMode } = useTempGrid()
|
const { tempGridMode } = useTempGrid()
|
||||||
@ -76,6 +82,9 @@ export function useOuterLineWall(setShowOutlineModal) {
|
|||||||
|
|
||||||
addCanvasMouseEventListener('mouse:down', mouseDown)
|
addCanvasMouseEventListener('mouse:down', mouseDown)
|
||||||
clear()
|
clear()
|
||||||
|
return () => {
|
||||||
|
initEvent()
|
||||||
|
}
|
||||||
}, [verticalHorizontalMode, points, adsorptionPointAddMode, adsorptionPointMode, adsorptionRange, interval, tempGridMode])
|
}, [verticalHorizontalMode, points, adsorptionPointAddMode, adsorptionPointMode, adsorptionRange, interval, tempGridMode])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
@ -209,10 +209,12 @@ export function useRoofShapePassivitySetting(setShowRoofShapePassivitySettingMod
|
|||||||
|
|
||||||
wall.lines = [...lines]
|
wall.lines = [...lines]
|
||||||
// 기존 그려진 지붕이 없다면
|
// 기존 그려진 지붕이 없다면
|
||||||
if (roofBases.length === 0) {
|
|
||||||
return
|
if (isFix.current) {
|
||||||
|
// 완료 한 경우에는 지붕까지 그려줌
|
||||||
|
const roof = drawRoofPolygon(wall)
|
||||||
}
|
}
|
||||||
const roof = drawRoofPolygon(wall)
|
|
||||||
canvas.renderAll()
|
canvas.renderAll()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -289,3 +289,8 @@ export const canGridOptionSeletor = selector({
|
|||||||
return points.length === 0 || outerLineFix
|
return points.length === 0 || outerLineFix
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
export const globalPitchState = atom({
|
||||||
|
key: 'globalPitch',
|
||||||
|
default: 4,
|
||||||
|
})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user