Merge pull request 'dev' (#613) from dev into prd-deploy

Reviewed-on: #613
This commit is contained in:
ysCha 2026-01-29 09:18:34 +09:00
commit 09a5fdba41
3 changed files with 49 additions and 19 deletions

View File

@ -179,7 +179,7 @@ export function useCanvasSetting(executeEffect = true) {
layout: ['ROOF_ID_SLATE', 'ROOF_ID_SINGLE'].includes(item.roofMatlCd) ? ROOF_MATERIAL_LAYOUT.STAIRS : ROOF_MATERIAL_LAYOUT.PARALLEL, layout: ['ROOF_ID_SLATE', 'ROOF_ID_SINGLE'].includes(item.roofMatlCd) ? ROOF_MATERIAL_LAYOUT.STAIRS : ROOF_MATERIAL_LAYOUT.PARALLEL,
hajebichi: item.roofPchBase && parseInt(item.roofPchBase), hajebichi: item.roofPchBase && parseInt(item.roofPchBase),
pitch: item.inclBase ? parseInt(item.inclBase) : 4, pitch: item.inclBase ? parseInt(item.inclBase) : 4,
angle: getDegreeByChon(item.inclBase ? parseInt(item.inclBase): 4) //item.angle ? parseInt(item.angle) : 21.8, angle: getDegreeByChon(item.inclBase ? parseInt(item.inclBase) : 4), //item.angle ? parseInt(item.angle) : 21.8,
})) }))
setRoofMaterials(roofLists) setRoofMaterials(roofLists)
return roofLists return roofLists
@ -231,8 +231,9 @@ export function useCanvasSetting(executeEffect = true) {
setPolygonLinesActualSize(roof) setPolygonLinesActualSize(roof)
}) })
changeCorridorDimensionText() changeCorridorDimensionText()
canvas.renderAll()
} }
}, [corridorDimension]) }, [corridorDimension, canvasSetting])
useEffect(() => { useEffect(() => {
if (!executeEffect) { if (!executeEffect) {

View File

@ -168,6 +168,9 @@ export const useLine = () => {
* @param pitch * @param pitch
*/ */
const setActualSize = (line, direction, pitch = globalPitch) => { const setActualSize = (line, direction, pitch = globalPitch) => {
if (line.attributes.isCalculated) {
return
}
const { x1, y1, x2, y2 } = line const { x1, y1, x2, y2 } = line
const isHorizontal = y1 === y2 const isHorizontal = y1 === y2
@ -209,7 +212,11 @@ export const useLine = () => {
} }
} }
line.attributes = { ...line.attributes, actualSize: Number(line.attributes.actualSize.toFixed(0)) } line.attributes = {
...line.attributes,
actualSize: Number(line.attributes.actualSize.toFixed(0)),
isCalculated: true,
}
} }
return { return {

View File

@ -973,7 +973,6 @@ export const usePolygon = () => {
}) })
canvas.renderAll() canvas.renderAll()
/*polygonLines.forEach((line) => { /*polygonLines.forEach((line) => {
line.set({ strokeWidth: 10 }) line.set({ strokeWidth: 10 })
canvas.add(line) canvas.add(line)
@ -1043,16 +1042,25 @@ export const usePolygon = () => {
name: 'newLine', name: 'newLine',
}) })
// 두 라인 중 큰 길이로 통일
const length1 = Math.round(Math.hypot(newLine1.x1 - newLine1.x2, newLine1.y1 - newLine1.y2)) * 10
const length2 = Math.round(Math.hypot(newLine2.x1 - newLine2.x2, newLine2.y1 - newLine2.y2)) * 10
const maxLength = Math.max(length1, length2)
const unifiedPlaneSize = line.attributes.planeSize ?? maxLength
const unifiedActualSize = line.attributes.actualSize ?? maxLength
newLine1.attributes = { newLine1.attributes = {
...line.attributes, ...line.attributes,
planeSize: Math.round(Math.hypot(newLine1.x1 - newLine1.x2, newLine1.y1 - newLine1.y2)) * 10, planeSize: unifiedPlaneSize,
actualSize: Math.round(Math.hypot(newLine1.x1 - newLine1.x2, newLine1.y1 - newLine1.y2)) * 10, actualSize: unifiedActualSize,
} }
newLine1.length = maxLength
newLine2.attributes = { newLine2.attributes = {
...line.attributes, ...line.attributes,
planeSize: Math.round(Math.hypot(newLine2.x1 - newLine2.x2, newLine2.y1 - newLine2.y2)) * 10, planeSize: unifiedPlaneSize,
actualSize: Math.round(Math.hypot(newLine2.x1 - newLine2.x2, newLine2.y1 - newLine2.y2)) * 10, actualSize: unifiedActualSize,
} }
newLine2.length = maxLength
newLines.push(newLine1, newLine2) newLines.push(newLine1, newLine2)
divideLines.splice(i, 1) // 기존 line 제거 divideLines.splice(i, 1) // 기존 line 제거
@ -1071,11 +1079,13 @@ export const usePolygon = () => {
name: 'newLine', name: 'newLine',
}) })
const calcLength = Math.round(Math.hypot(newLine.x1 - newLine.x2, newLine.y1 - newLine.y2)) * 10
newLine.attributes = { newLine.attributes = {
...line.attributes, ...line.attributes,
planeSize: Math.round(Math.hypot(newLine.x1 - newLine.x2, newLine.y1 - newLine.y2)) * 10, planeSize: line.attributes.planeSize ?? calcLength,
actualSize: Math.round(Math.hypot(newLine.x1 - newLine.x2, newLine.y1 - newLine.y2)) * 10, actualSize: line.attributes.actualSize ?? calcLength,
} }
newLine.length = line.attributes.planeSize ?? calcLength
newLines.push(newLine) newLines.push(newLine)
currentPoint = minDistancePoint currentPoint = minDistancePoint
@ -1089,11 +1099,13 @@ export const usePolygon = () => {
attributes: line.attributes, attributes: line.attributes,
name: 'newLine', name: 'newLine',
}) })
const lastCalcLength = Math.round(Math.hypot(newLine.x1 - newLine.x2, newLine.y1 - newLine.y2)) * 10
newLine.attributes = { newLine.attributes = {
...line.attributes, ...line.attributes,
planeSize: Math.round(Math.hypot(newLine.x1 - newLine.x2, newLine.y1 - newLine.y2)) * 10, planeSize: line.attributes.planeSize ?? lastCalcLength,
actualSize: Math.round(Math.hypot(newLine.x1 - newLine.x2, newLine.y1 - newLine.y2)) * 10, actualSize: line.attributes.actualSize ?? lastCalcLength,
} }
newLine.length = line.attributes.planeSize ?? lastCalcLength
newLines.push(newLine) newLines.push(newLine)
divideLines.splice(i, 1) // 기존 line 제거 divideLines.splice(i, 1) // 기존 line 제거
@ -1946,23 +1958,33 @@ export const usePolygon = () => {
const line2 = allRoofLines[j] const line2 = allRoofLines[j]
const diff = Math.abs(line1.length - line2.length) const diff = Math.abs(line1.length - line2.length)
if (diff > 0 && diff <= 2) { if (diff > 0 && diff <= 2) {
const minLength = Math.min(line1.length, line2.length) const maxLength = Math.max(line1.length, line2.length)
line1.setLengthByValue(minLength * 10) line1.setLengthByValue(maxLength * 10)
line2.setLengthByValue(minLength * 10) line2.setLengthByValue(maxLength * 10)
// attributes도 통일
const maxPlaneSize = Math.max(line1.attributes.planeSize || 0, line2.attributes.planeSize || 0)
const maxActualSize = Math.max(line1.attributes.actualSize || 0, line2.attributes.actualSize || 0)
line1.attributes.planeSize = maxPlaneSize
line1.attributes.actualSize = maxActualSize
line2.attributes.planeSize = maxPlaneSize
line2.attributes.actualSize = maxActualSize
} }
} }
} }
polygon.lines.forEach((line, index) => { polygon.lines.forEach((line, index) => {
if (line.attributes.isCalculated) {
return
}
//text 와 planSize 및 actualSize가 안맞는 문제 //text 와 planSize 및 actualSize가 안맞는 문제
const nextText = polygon?.texts?.[index]?.text /*const nextText = polygon?.texts?.[index]?.text
const nextPlaneSize = Number(nextText) const nextPlaneSize = Number(nextText)
if (nextText != null && nextText !== '' && Number.isFinite(nextPlaneSize)) { if (nextText != null && nextText !== '' && Number.isFinite(nextPlaneSize)) {
if (line.attributes.actualSize !== nextPlaneSize && line.attributes.planeSize !== nextPlaneSize) { if (line.attributes.actualSize !== nextPlaneSize && line.attributes.planeSize !== nextPlaneSize) {
line.attributes.planeSize = nextPlaneSize line.attributes.planeSize = nextPlaneSize
} }
}*/
}
setActualSize(line, polygon.direction, +polygon.roofMaterial?.pitch) setActualSize(line, polygon.direction, +polygon.roofMaterial?.pitch)
}) })