Merge branch 'dev' of ssh://git.jetbrains.space/nalpari/q-cast-iii/qcast-front into dev
This commit is contained in:
commit
17e5fba8d8
@ -1,10 +1,11 @@
|
|||||||
import { useRecoilValue } from 'recoil'
|
import { useRecoilValue, useResetRecoilState } from 'recoil'
|
||||||
import { canvasState, currentObjectState } from '@/store/canvasAtom'
|
import { canvasState, currentObjectState } from '@/store/canvasAtom'
|
||||||
import { selectedRoofMaterialSelector } from '@/store/settingAtom'
|
import { selectedRoofMaterialSelector } from '@/store/settingAtom'
|
||||||
import { ROOF_MATERIAL_LAYOUT } from '@/components/floor-plan/modal/placementShape/PlacementShapeSetting'
|
import { ROOF_MATERIAL_LAYOUT } from '@/components/floor-plan/modal/placementShape/PlacementShapeSetting'
|
||||||
import { POLYGON_TYPE } from '@/common/common'
|
import { POLYGON_TYPE } from '@/common/common'
|
||||||
import { useEvent } from '@/hooks/useEvent'
|
import { useEvent } from '@/hooks/useEvent'
|
||||||
import { useLine } from '@/hooks/useLine'
|
import { useLine } from '@/hooks/useLine'
|
||||||
|
import { outerLinePointsState } from '@/store/outerLineAtom'
|
||||||
|
|
||||||
const ROOF_COLOR = {
|
const ROOF_COLOR = {
|
||||||
0: 'rgb(199,240,213)',
|
0: 'rgb(199,240,213)',
|
||||||
@ -17,6 +18,7 @@ export function useRoofFn() {
|
|||||||
const selectedRoofMaterial = useRecoilValue(selectedRoofMaterialSelector)
|
const selectedRoofMaterial = useRecoilValue(selectedRoofMaterialSelector)
|
||||||
const currentObject = useRecoilValue(currentObjectState)
|
const currentObject = useRecoilValue(currentObjectState)
|
||||||
const { addCanvasMouseEventListener, initEvent } = useEvent()
|
const { addCanvasMouseEventListener, initEvent } = useEvent()
|
||||||
|
const resetPoints = useResetRecoilState(outerLinePointsState)
|
||||||
const { addPitchText } = useLine()
|
const { addPitchText } = useLine()
|
||||||
|
|
||||||
//면형상 선택 클릭시 지붕 패턴 입히기
|
//면형상 선택 클릭시 지붕 패턴 입히기
|
||||||
@ -332,6 +334,7 @@ export function useRoofFn() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
canvas.renderAll()
|
canvas.renderAll()
|
||||||
|
resetPoints()
|
||||||
}
|
}
|
||||||
|
|
||||||
return { setSurfaceShapePattern, removeRoofMaterial, removeAllRoofMaterial, moveRoofMaterial, removeOuterLines }
|
return { setSurfaceShapePattern, removeRoofMaterial, removeAllRoofMaterial, moveRoofMaterial, removeOuterLines }
|
||||||
|
|||||||
@ -7,6 +7,9 @@ import { usePolygon } from '@/hooks/usePolygon'
|
|||||||
import { useLine } from '@/hooks/useLine'
|
import { useLine } from '@/hooks/useLine'
|
||||||
import { outerLinePointsState } from '@/store/outerLineAtom'
|
import { outerLinePointsState } from '@/store/outerLineAtom'
|
||||||
import { usePopup } from '@/hooks/usePopup'
|
import { usePopup } from '@/hooks/usePopup'
|
||||||
|
import PropertiesSetting from '@/components/floor-plan/modal/outerlinesetting/PropertiesSetting'
|
||||||
|
import RoofShapeSetting from '@/components/floor-plan/modal/roofShape/RoofShapeSetting'
|
||||||
|
import RoofAllocationSetting from '@/components/floor-plan/modal/roofAllocation/RoofAllocationSetting'
|
||||||
|
|
||||||
// 외벽선 속성 설정
|
// 외벽선 속성 설정
|
||||||
export function usePropertiesSetting(id) {
|
export function usePropertiesSetting(id) {
|
||||||
@ -19,7 +22,7 @@ export function usePropertiesSetting(id) {
|
|||||||
|
|
||||||
const { addPolygonByLines } = usePolygon()
|
const { addPolygonByLines } = usePolygon()
|
||||||
const { removeLine, hideLine } = useLine()
|
const { removeLine, hideLine } = useLine()
|
||||||
const { closePopup } = usePopup()
|
const { addPopup, closePopup } = usePopup()
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const lines = canvas.getObjects().filter((obj) => obj.name === 'outerLine')
|
const lines = canvas.getObjects().filter((obj) => obj.name === 'outerLine')
|
||||||
@ -134,7 +137,8 @@ export function usePropertiesSetting(id) {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
canvas.discardActiveObject()
|
canvas.discardActiveObject()
|
||||||
closePopup(id)
|
// closePopup(id)
|
||||||
|
addPopup(id, 1, <RoofShapeSetting id={id} pos={{ x: 50, y: 230 }} />)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -157,10 +161,7 @@ export function usePropertiesSetting(id) {
|
|||||||
setPoints([])
|
setPoints([])
|
||||||
canvas.renderAll()
|
canvas.renderAll()
|
||||||
roof.drawHelpLine()
|
roof.drawHelpLine()
|
||||||
|
addPopup(id, 1, <RoofAllocationSetting id={id} pos={{ x: 50, y: 230 }} />)
|
||||||
closePopup(id)
|
|
||||||
return
|
|
||||||
} else {
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { useRecoilState, useRecoilValue, useSetRecoilState } from 'recoil'
|
import { useRecoilState, useRecoilValue, useResetRecoilState, useSetRecoilState } from 'recoil'
|
||||||
import { canvasState, currentAngleTypeSelector, currentMenuState, currentObjectState } from '@/store/canvasAtom'
|
import { canvasState, currentAngleTypeSelector, currentMenuState, currentObjectState } from '@/store/canvasAtom'
|
||||||
import { useEffect, useRef, useState } from 'react'
|
import { useEffect, useRef, useState } from 'react'
|
||||||
import { useAxios } from '@/hooks/useAxios'
|
import { useAxios } from '@/hooks/useAxios'
|
||||||
@ -26,6 +26,7 @@ import { globalLocaleStore } from '@/store/localeAtom'
|
|||||||
import { getChonByDegree, getDegreeByChon } from '@/util/canvas-util'
|
import { getChonByDegree, getDegreeByChon } from '@/util/canvas-util'
|
||||||
import { moduleSelectionDataState } from '@/store/selectedModuleOptions'
|
import { moduleSelectionDataState } from '@/store/selectedModuleOptions'
|
||||||
import { useCanvasPopupStatusController } from '@/hooks/common/useCanvasPopupStatusController'
|
import { useCanvasPopupStatusController } from '@/hooks/common/useCanvasPopupStatusController'
|
||||||
|
import { outerLinePointsState } from '@/store/outerLineAtom'
|
||||||
|
|
||||||
// 지붕면 할당
|
// 지붕면 할당
|
||||||
export function useRoofAllocationSetting(id) {
|
export function useRoofAllocationSetting(id) {
|
||||||
@ -55,6 +56,7 @@ export function useRoofAllocationSetting(id) {
|
|||||||
const { setSurfaceShapePattern } = useRoofFn()
|
const { setSurfaceShapePattern } = useRoofFn()
|
||||||
|
|
||||||
const [moduleSelectionData, setModuleSelectionData] = useRecoilState(moduleSelectionDataState)
|
const [moduleSelectionData, setModuleSelectionData] = useRecoilState(moduleSelectionDataState)
|
||||||
|
const resetPoints = useResetRecoilState(outerLinePointsState)
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setCurrentRoofList(roofList)
|
setCurrentRoofList(roofList)
|
||||||
@ -256,6 +258,7 @@ export function useRoofAllocationSetting(id) {
|
|||||||
addPopup(popupId, 1, <ActualSizeSetting id={popupId} />)
|
addPopup(popupId, 1, <ActualSizeSetting id={popupId} />)
|
||||||
} else {
|
} else {
|
||||||
apply()
|
apply()
|
||||||
|
resetPoints()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -316,7 +319,7 @@ export function useRoofAllocationSetting(id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const apply = () => {
|
const apply = () => {
|
||||||
const roofBases = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.ROOF)
|
const roofBases = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.ROOF && !obj.roofMaterial)
|
||||||
const wallLines = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.WALL)
|
const wallLines = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.WALL)
|
||||||
roofBases.forEach((roofBase) => {
|
roofBases.forEach((roofBase) => {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@ -10,6 +10,7 @@ import { outerLineFixState } from '@/store/outerLineAtom'
|
|||||||
import { useSwal } from '@/hooks/useSwal'
|
import { useSwal } from '@/hooks/useSwal'
|
||||||
import { usePopup } from '@/hooks/usePopup'
|
import { usePopup } from '@/hooks/usePopup'
|
||||||
import { getChonByDegree } from '@/util/canvas-util'
|
import { getChonByDegree } from '@/util/canvas-util'
|
||||||
|
import RoofAllocationSetting from '@/components/floor-plan/modal/roofAllocation/RoofAllocationSetting'
|
||||||
|
|
||||||
// 지붕형상 설정
|
// 지붕형상 설정
|
||||||
export function useRoofShapeSetting(id) {
|
export function useRoofShapeSetting(id) {
|
||||||
@ -46,7 +47,7 @@ export function useRoofShapeSetting(id) {
|
|||||||
const jerkinHeadPitchRef = useRef(null)
|
const jerkinHeadPitchRef = useRef(null)
|
||||||
|
|
||||||
const history = useRef([])
|
const history = useRef([])
|
||||||
const { closePopup } = usePopup()
|
const { closePopup, addPopup } = usePopup()
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
pitchRef.current = currentAngleType === ANGLE_TYPE.SLOPE ? pitch : getChonByDegree(pitch)
|
pitchRef.current = currentAngleType === ANGLE_TYPE.SLOPE ? pitch : getChonByDegree(pitch)
|
||||||
@ -422,7 +423,13 @@ export function useRoofShapeSetting(id) {
|
|||||||
canvas.remove(obj)
|
canvas.remove(obj)
|
||||||
})
|
})
|
||||||
|
|
||||||
const removeTargets = canvas.getObjects().filter((obj) => obj.name === 'pitchText' || obj.name === 'lengthText')
|
const removeTargets = canvas
|
||||||
|
.getObjects()
|
||||||
|
.filter(
|
||||||
|
(obj) =>
|
||||||
|
(obj.name === 'pitchText' || obj.name === 'lengthText') &&
|
||||||
|
canvas.getObjects().find((parent) => parent.id === obj.parentId)?.name !== POLYGON_TYPE.ROOF,
|
||||||
|
)
|
||||||
removeTargets.forEach((obj) => {
|
removeTargets.forEach((obj) => {
|
||||||
canvas.remove(obj)
|
canvas.remove(obj)
|
||||||
})
|
})
|
||||||
@ -436,7 +443,7 @@ export function useRoofShapeSetting(id) {
|
|||||||
canvas?.renderAll()
|
canvas?.renderAll()
|
||||||
roof.drawHelpLine()
|
roof.drawHelpLine()
|
||||||
isFixRef.current = true
|
isFixRef.current = true
|
||||||
closePopup(id)
|
addPopup(id, 1, <RoofAllocationSetting id={id} pos={{ x: 50, y: 230 }} />)
|
||||||
}
|
}
|
||||||
|
|
||||||
const initLineSetting = () => {
|
const initLineSetting = () => {
|
||||||
@ -568,6 +575,7 @@ export function useRoofShapeSetting(id) {
|
|||||||
pitch: pitchRef.current,
|
pitch: pitchRef.current,
|
||||||
offset: eavesOffset / 10,
|
offset: eavesOffset / 10,
|
||||||
}
|
}
|
||||||
|
selectedLine.attributes = { ...attributes, isFixed: true }
|
||||||
addPitchText(currentObject)
|
addPitchText(currentObject)
|
||||||
selectedLine.set({ strokeWidth: 4 })
|
selectedLine.set({ strokeWidth: 4 })
|
||||||
selectedLine.set({ stroke: '#45CD7D' })
|
selectedLine.set({ stroke: '#45CD7D' })
|
||||||
@ -579,6 +587,7 @@ export function useRoofShapeSetting(id) {
|
|||||||
type: LINE_TYPE.WALLLINE.GABLE,
|
type: LINE_TYPE.WALLLINE.GABLE,
|
||||||
offset: gableOffset / 10,
|
offset: gableOffset / 10,
|
||||||
}
|
}
|
||||||
|
selectedLine.attributes = { ...attributes, isFixed: true }
|
||||||
selectedLine.set({ strokeWidth: 4 })
|
selectedLine.set({ strokeWidth: 4 })
|
||||||
selectedLine.set({ stroke: '#3FBAE6' })
|
selectedLine.set({ stroke: '#3FBAE6' })
|
||||||
break
|
break
|
||||||
@ -590,6 +599,7 @@ export function useRoofShapeSetting(id) {
|
|||||||
width: hasSleeve === '0' ? 0 : sleeveOffset / 10,
|
width: hasSleeve === '0' ? 0 : sleeveOffset / 10,
|
||||||
sleeve: hasSleeve === '1',
|
sleeve: hasSleeve === '1',
|
||||||
}
|
}
|
||||||
|
selectedLine.attributes = { ...attributes, isFixed: true }
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
case 4: {
|
case 4: {
|
||||||
@ -600,6 +610,7 @@ export function useRoofShapeSetting(id) {
|
|||||||
offset: eavesOffset / 10,
|
offset: eavesOffset / 10,
|
||||||
width: hipAndGableWidth / 10,
|
width: hipAndGableWidth / 10,
|
||||||
}
|
}
|
||||||
|
selectedLine.attributes = { ...attributes, isFixed: true }
|
||||||
addPitchText(currentObject)
|
addPitchText(currentObject)
|
||||||
selectedLine.set({ strokeWidth: 4 })
|
selectedLine.set({ strokeWidth: 4 })
|
||||||
selectedLine.set({ stroke: '#45CD7D' })
|
selectedLine.set({ stroke: '#45CD7D' })
|
||||||
@ -613,6 +624,7 @@ export function useRoofShapeSetting(id) {
|
|||||||
width: jerkinHeadWidth / 10,
|
width: jerkinHeadWidth / 10,
|
||||||
pitch: jerkinHeadPitchRef.current,
|
pitch: jerkinHeadPitchRef.current,
|
||||||
}
|
}
|
||||||
|
selectedLine.attributes = { ...attributes, isFixed: true }
|
||||||
addPitchText(currentObject)
|
addPitchText(currentObject)
|
||||||
selectedLine.set({ strokeWidth: 4 })
|
selectedLine.set({ strokeWidth: 4 })
|
||||||
selectedLine.set({ stroke: '#3FBAE6' })
|
selectedLine.set({ stroke: '#3FBAE6' })
|
||||||
@ -625,13 +637,13 @@ export function useRoofShapeSetting(id) {
|
|||||||
pitch: shedPitchRef.current,
|
pitch: shedPitchRef.current,
|
||||||
width: shedWidth / 10,
|
width: shedWidth / 10,
|
||||||
}
|
}
|
||||||
|
selectedLine.attributes = { ...attributes, isFixed: true }
|
||||||
addPitchText(currentObject)
|
addPitchText(currentObject)
|
||||||
selectedLine.set({ strokeWidth: 4 })
|
selectedLine.set({ strokeWidth: 4 })
|
||||||
selectedLine.set({ stroke: '#000000' })
|
selectedLine.set({ stroke: '#000000' })
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
selectedLine.attributes = { ...attributes, isFixed: true }
|
|
||||||
|
|
||||||
canvas.renderAll()
|
canvas.renderAll()
|
||||||
nextLineFocus(selectedLine)
|
nextLineFocus(selectedLine)
|
||||||
@ -643,7 +655,7 @@ export function useRoofShapeSetting(id) {
|
|||||||
const index = lines.findIndex((line) => line.idx === selectedLine.idx)
|
const index = lines.findIndex((line) => line.idx === selectedLine.idx)
|
||||||
|
|
||||||
const nextLine = lines[index + 1] || lines[0]
|
const nextLine = lines[index + 1] || lines[0]
|
||||||
if (nextLine.attributes.isFixed) {
|
if (nextLine.attributes?.isFixed) {
|
||||||
canvas.discardActiveObject()
|
canvas.discardActiveObject()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user