Merge remote-tracking branch 'origin/qcast-pub' into dev
This commit is contained in:
commit
c7188da100
@ -18,8 +18,8 @@ export function useModuleBasicSetting() {
|
||||
const roofDisplay = useRecoilValue(roofDisplaySelector)
|
||||
const [moduleSetupSurface, setModuleSetupSurface] = useRecoilState(moduleSetupSurfaceState)
|
||||
const [moduleIsSetup, setModuleIsSetup] = useRecoilState(moduleIsSetupState)
|
||||
// const { addTargetMouseEventListener, addCanvasMouseEventListener, initEvent } = useEvent()
|
||||
const { addTargetMouseEventListener, addCanvasMouseEventListener, initEvent } = useContext(EventContext)
|
||||
const { addTargetMouseEventListener, addCanvasMouseEventListener, initEvent } = useEvent()
|
||||
// const { addTargetMouseEventListener, addCanvasMouseEventListener, initEvent } = useContext(EventContext)
|
||||
const [flowModuleLine, setFlowModuleLine] = useState({})
|
||||
let selectedModuleInstSurfaceArray = []
|
||||
|
||||
|
||||
@ -18,7 +18,7 @@ import { menuTypeState } from '@/store/menuAtom'
|
||||
export function useRoofAllocationSetting(id) {
|
||||
const canvas = useRecoilValue(canvasState)
|
||||
const roofDisplay = useRecoilValue(roofDisplaySelector)
|
||||
const { drawDirectionArrow, addLengthText, splitPolygonWithLines } = usePolygon()
|
||||
const { drawDirectionArrow, addLengthText, splitPolygonWithLines, splitPolygonWithSeparate } = usePolygon()
|
||||
const [popupId, setPopupId] = useState(uuidv4())
|
||||
const { addPopup, closePopup, closeAll } = usePopup()
|
||||
const { getMessage } = useMessage()
|
||||
@ -188,16 +188,19 @@ export function useRoofAllocationSetting(id) {
|
||||
const wallLines = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.WALL)
|
||||
roofBases.forEach((roofBase) => {
|
||||
try {
|
||||
splitPolygonWithLines(roofBase)
|
||||
if (roofBase.separatePolygon.length > 0) {
|
||||
splitPolygonWithSeparate(roofBase.separatePolygon)
|
||||
} else {
|
||||
splitPolygonWithLines(roofBase)
|
||||
}
|
||||
} catch (e) {
|
||||
return
|
||||
}
|
||||
|
||||
roofBase.innerLines.forEach((line) => {
|
||||
canvas.remove(line)
|
||||
})
|
||||
|
||||
// canvas.remove(roofBase)
|
||||
canvas.remove(roofBase)
|
||||
})
|
||||
|
||||
wallLines.forEach((wallLine) => {
|
||||
|
||||
@ -1026,6 +1026,47 @@ export const usePolygon = () => {
|
||||
})
|
||||
}
|
||||
|
||||
const splitPolygonWithSeparate = (separates) => {
|
||||
separates.forEach((separate) => {
|
||||
const points = separate.lines.map((line) => {
|
||||
return { x: line.x1, y: line.y1 }
|
||||
})
|
||||
let defense = ''
|
||||
switch (separate.attributes.direction) {
|
||||
case 'top':
|
||||
defense = 'east'
|
||||
break
|
||||
case 'right':
|
||||
defense = 'south'
|
||||
break
|
||||
case 'bottom':
|
||||
defense = 'west'
|
||||
break
|
||||
case 'left':
|
||||
defense = 'north'
|
||||
break
|
||||
}
|
||||
|
||||
const roof = new QPolygon(points, {
|
||||
fontSize: separate.fontSize,
|
||||
stroke: 'black',
|
||||
fill: 'transparent',
|
||||
strokeWidth: 3,
|
||||
name: POLYGON_TYPE.ROOF,
|
||||
originX: 'center',
|
||||
originY: 'center',
|
||||
selectable: true,
|
||||
defense: defense,
|
||||
pitch: separate.attributes.pitch,
|
||||
direction: defense,
|
||||
})
|
||||
|
||||
canvas.add(roof)
|
||||
})
|
||||
|
||||
canvas.renderAll()
|
||||
}
|
||||
|
||||
return {
|
||||
addPolygon,
|
||||
addPolygonByLines,
|
||||
@ -1033,5 +1074,6 @@ export const usePolygon = () => {
|
||||
drawDirectionArrow,
|
||||
addLengthText,
|
||||
splitPolygonWithLines,
|
||||
splitPolygonWithSeparate,
|
||||
}
|
||||
}
|
||||
|
||||
@ -1640,7 +1640,13 @@ export const drawGabledRoof = (roofId, canvas) => {
|
||||
selectable: false,
|
||||
fontSize: roof.fontSize,
|
||||
name: 'roofPolygon',
|
||||
attributes: { roofId: roof.id, currentRoof: currentRoof.id },
|
||||
attributes: {
|
||||
roofId: roof.id,
|
||||
currentRoof: currentRoof.id,
|
||||
pitch: currentRoof.attributes.pitch,
|
||||
degree: currentRoof.attributes.degree,
|
||||
direction: currentRoof.direction,
|
||||
},
|
||||
})
|
||||
const currentDegree = currentRoof.attributes.pitch > 0 ? getDegreeByChon(currentRoof.attributes.pitch) : currentRoof.attributes.degree
|
||||
//지붕 각도에 따른 실측치 조정
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user