dev #106

Merged
ysCha merged 9 commits from dev into prd-deploy 2025-06-09 17:10:54 +09:00
Showing only changes of commit bb7b9c020f - Show all commits

View File

@ -26,6 +26,7 @@ import { useImgLoader } from '@/hooks/floorPlan/useImgLoader'
import { usePlan } from '@/hooks/usePlan'
import { QcastContext } from '@/app/QcastProvider'
import { fabric } from 'fabric'
import { fontSelector } from '@/store/fontAtom'
const ALLOCATION_TYPE = {
AUTO: 'auto',
@ -45,6 +46,9 @@ export default function CircuitTrestleSetting({ id }) {
const { managementState, setManagementState } = useContext(GlobalDataContext)
const selectedModules = useRecoilValue(selectedModuleState)
const { getPcsAutoRecommendList, getPcsVoltageChk, getPcsVoltageStepUpList, getPcsManualConfChk } = useMasterController()
const flowText = useRecoilValue(fontSelector('flowText'))
const lengthText = useRecoilValue(fontSelector('lengthText'))
const circuitNumberText = useRecoilValue(fontSelector('circuitNumberText'))
// ()
const [selectedStepUpValues, setSelectedStepUpValues] = useState({})
@ -103,19 +107,26 @@ export default function CircuitTrestleSetting({ id }) {
}
}, [])
// 50%
const handleZoomCompression = () => {
//
const beforeCapture = () => {
// setCanvasZoom(100)
const x = canvas.width / 2
const y = canvas.height / 2
canvas.zoomToPoint(new fabric.Point(x, y), 0.5)
changeFontSize('lengthText', '28')
changeFontSize('circuitNumber', '28')
changeFontSize('flowText', '28')
canvas.renderAll()
}
const handleZoomClear = () => {
//
const afterCapture = () => {
setCanvasZoom(100)
canvas.set({ zoom: 1 })
canvas.viewportTransform = [1, 0, 0, 1, 0, 0]
changeFontSize('lengthText', lengthText.fontSize.value)
changeFontSize('circuitNumber', circuitNumberText.fontSize.value)
changeFontSize('flowText', flowText.fontSize.value)
canvas.renderAll()
}
@ -360,7 +371,7 @@ export default function CircuitTrestleSetting({ id }) {
// ()
const onApply = async () => {
handleZoomCompression()
beforeCapture()
setAllModuleSurfaceIsComplete(false)
setIsGlobalLoading(true)
@ -392,7 +403,7 @@ export default function CircuitTrestleSetting({ id }) {
if (result) {
handleCanvasToPng(2)
handleZoomClear()
afterCapture()
//
await saveEstimate(result)
} else {
@ -402,6 +413,16 @@ export default function CircuitTrestleSetting({ id }) {
// removeNotAllocationModules()
}
const changeFontSize = (name, size) => {
const textObjs = canvas?.getObjects().filter((obj) => obj.name === name)
textObjs.forEach((obj) => {
obj.set({
fontSize: size,
})
})
canvas.renderAll()
}
//
const onClickPrev = () => {
// setAllocationType(ALLOCATION_TYPE.AUTO)