#578 [회로]가 할당되지 않은 모듈관련건

This commit is contained in:
hyojun.choi 2025-02-06 16:16:42 +09:00
parent 8fe9e11f1d
commit ae57338aab
3 changed files with 25 additions and 5 deletions

View File

@ -30,7 +30,7 @@ const ALLOCATION_TYPE = {
export default function CircuitTrestleSetting({ id }) {
const { getMessage } = useMessage()
const { closePopup } = usePopup()
const { apply } = useTrestle()
const { apply, hideCircuitNumberTexts } = useTrestle()
const { swalFire } = useSwal()
const { saveEstimate } = useEstimate()
const canvas = useRecoilValue(canvasState)
@ -450,11 +450,16 @@ export default function CircuitTrestleSetting({ id }) {
obj.pcses = getStepUpListData()
})
hideCircuitNumberTexts()
//TODO :
const result = await apply()
if (result) {
// TODO :
await saveEstimate(result)
}
removeNotAllocationModules()
// removeNotAllocationModules()
}
const removeNotAllocationModules = () => {

View File

@ -18,6 +18,11 @@ export const useTrestle = () => {
const isTrestleDisplay = useRecoilValue(trestleDisplaySelector)
const { swalFire } = useSwal()
const apply = () => {
const notAllocationModules = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.MODULE && !obj.circuit)
if (notAllocationModules.length > 0) {
swalFire({ text: '回路番号が設定されていないモジュールがあります。 番号を設定しなおすか、 パネルを削除してください。', icon: 'error' })
return null
}
try {
//처마력바가 체크되어 있는 경우 exposedBottomPoints를 이용해 처마력바 그려줘야함.
// exposedBottomPoints는 노출 최하면 들의 centerPoint 배열.
@ -2227,5 +2232,15 @@ export const useTrestle = () => {
})
}
return { apply, getTrestleParams, clear }
// 전모듈 의 회로번호 visible false 처리
// 가대 설치 전 필요
const hideCircuitNumberTexts = () => {
const circuitNumberTexts = canvas.getObjects().filter((obj) => obj.name === 'circuitNumber')
circuitNumberTexts.forEach((text) => {
text.visible = false
})
canvas.renderAll()
}
return { apply, getTrestleParams, clear, hideCircuitNumberTexts }
}

View File

@ -11,10 +11,10 @@ export function useMouse() {
const mouseLines = canvas.getObjects().filter((obj) => obj.name === 'mouseLine')
if (mouseLines.length < 2) {
return pointer
return { x: Math.round(pointer.x), y: Math.round(pointer.y) }
}
return getInterSectionLineNotOverCoordinate(mouseLines[0], mouseLines[1]) || pointer
return getInterSectionLineNotOverCoordinate(mouseLines[0], mouseLines[1]) || { x: Math.round(pointer.x), y: Math.round(pointer.y) }
}
return {