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

Reviewed-on: #280
This commit is contained in:
ysCha 2025-08-08 14:52:06 +09:00
commit a01f9c2bd1
4 changed files with 39 additions and 5 deletions

View File

@ -214,6 +214,7 @@ export const SAVE_KEY = [
'isSortedPoints',
'isMultipleOf45',
'from',
'originColor',
]
export const OBJECT_PROTOTYPE = [fabric.Line.prototype, fabric.Polygon.prototype, fabric.Triangle.prototype, fabric.Group.prototype]

View File

@ -262,6 +262,12 @@ export const Orientation = forwardRef((props, ref) => {
setRoofsStore(newRoofs)
}
useEffect(() => {
// selectedModules handleChangeModule
if (moduleList.length > 0 && (!selectedModules || !selectedModules.itemId)) {
handleChangeModule(moduleList[0]);
}
}, [moduleList]); //
return (
<>
<div className="properties-setting-wrap">

View File

@ -103,11 +103,11 @@ export default function CircuitTrestleSetting({ id }) {
}, [])
const capture = async (type) => {
beforeCapture()
beforeCapture(type)
await handleCanvasToPng(type)
afterCapture()
afterCapture(type)
return new Promise((resolve) => {
setTimeout(() => {
@ -117,11 +117,23 @@ export default function CircuitTrestleSetting({ id }) {
}
//
const beforeCapture = () => {
const beforeCapture = (type) => {
setCanvasZoom(100)
canvas.set({ zoom: 1 })
canvas.viewportTransform = [1, 0, 0, 1, 0, 0]
const modules = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.MODULE)
const circuitNumberTexts = canvas.getObjects().filter((obj) => obj.name === 'circuitNumber')
if (type === 2) {
modules.forEach((module) => {
module.set({ originColor: module.fill, fill: null, strokeWidth: 2 })
})
circuitNumberTexts.forEach((text) => {
text.set({ visible: false })
})
}
canvas.renderAll()
// roof polygon
@ -169,13 +181,27 @@ export default function CircuitTrestleSetting({ id }) {
}
//
const afterCapture = () => {
const afterCapture = (type) => {
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)
const modules = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.MODULE)
const circuitNumberTexts = canvas.getObjects().filter((obj) => obj.name === 'circuitNumber')
if (type === 2) {
modules.forEach((module) => {
module.set({
fill: module.originColor,
strokeWidth: 0.3,
})
})
circuitNumberTexts.forEach((text) => {
text.set({ visible: true })
})
}
canvas.renderAll()
}

View File

@ -847,7 +847,8 @@ export const usePolygon = () => {
// innerLine의 type을 polygonLine의 type으로 변경
if (polygonLine.attributes?.type && innerLine.attributes) {
// polygonLine.need = false
innerLine.attributes = { ...polygonLine.attributes }
innerLine.attributes.planeSize = innerLine.attributes.planeSize ?? polygonLine.attributes.planeSize
innerLine.attributes.actualSize = innerLine.attributes.actualSize ?? polygonLine.attributes.actualSize
innerLine.direction = polygonLine.direction
innerLine.attributes.isStart = true
}