diff --git a/src/components/estimate/Estimate.jsx b/src/components/estimate/Estimate.jsx
index f4214e68..deb95caf 100644
--- a/src/components/estimate/Estimate.jsx
+++ b/src/components/estimate/Estimate.jsx
@@ -1129,6 +1129,14 @@ export default function Estimate({}) {
setSpecialNoteFirstFlg(false)
}, [estimateContextState.resetFlag])
+ useEffect(() => {
+ if (estimateContextState?.itemList.length > 0) {
+ const tempList = estimateContextState.itemList.filter((item) => !displayItemList.some((resItem) => resItem.itemId === item.itemId))
+ if (tempList.length > 0) {
+ setDisplayItemList((prevList) => [...prevList, ...tempList])
+ }
+ }
+ }, [estimateContextState])
return (
diff --git a/src/hooks/option/useCanvasSetting.js b/src/hooks/option/useCanvasSetting.js
index 08ac6470..179b2221 100644
--- a/src/hooks/option/useCanvasSetting.js
+++ b/src/hooks/option/useCanvasSetting.js
@@ -140,7 +140,6 @@ export function useCanvasSetting() {
const selectedRoofMaterial = useRecoilValue(selectedRoofMaterialSelector) // 선택된 지붕재 정보
const { floorPlanState } = useContext(FloorPlanContext) // 플랜 상태
const { closeAll } = usePopup() // 팝업 닫기
- const [isRoofMaterialsLoaded, setIsRoofMaterialsLoaded] = useState(false) // roofMaterials 로드 상태 확인
useEffect(() => {
const tempFetchRoofMaterials = !fetchRoofMaterials
@@ -152,15 +151,6 @@ export function useCanvasSetting() {
}
}, [])
- /**
- * roofMaterials가 변경될 때마다 로드 상태 업데이트
- */
- useEffect(() => {
- if (roofMaterials.length > 0) {
- setIsRoofMaterialsLoaded(true)
- }
- }, [roofMaterials])
-
/**
* 지붕재 초기세팅
*/
@@ -319,23 +309,6 @@ export function useCanvasSetting() {
*/
const fetchBasicSettings = async (planNo, openPoint) => {
try {
- /* roofMaterials가 로드될 때까지 대기 후 실행 */
- if (!isRoofMaterialsLoaded) {
- /* roofMaterials가 아직 로드되지 않았다면 */
- await new Promise((resolve) => {
- /* 새로운 Promise 생성 */
- const checkInterval = setInterval(() => {
- /* 100ms마다 체크하는 인터벌 설정 */
- console.log('roofMaterials loading... ', roofMaterials.length)
- if (roofMaterials.length > 0) {
- /* roofMaterials가 로드되었다면 */
- clearInterval(checkInterval) // 인터벌 중지
- resolve() // Promise 완료
- }
- }, 100)
- })
- }
-
await get({
url: `/api/canvas-management/canvas-basic-settings/by-object/${correntObjectNo}/${planNo}`,
}).then((res) => {
diff --git a/src/hooks/surface/useRoofLinePropertySetting.js b/src/hooks/surface/useRoofLinePropertySetting.js
index 22fde4b6..ba5eedee 100644
--- a/src/hooks/surface/useRoofLinePropertySetting.js
+++ b/src/hooks/surface/useRoofLinePropertySetting.js
@@ -12,6 +12,7 @@ const LINE_COLOR = {
GABLE: '#3FBAE6',
RIDGE: '#9e9e9e',
DEFAULT: '#000000',
+ ACTIVE: '#EA10AC',
}
export function useRoofLinePropertySetting(id, roof) {
@@ -23,9 +24,9 @@ export function useRoofLinePropertySetting(id, roof) {
const { getMessage } = useMessage()
useEffect(() => {
- if (currentObject) {
+ if (currentObject && currentObject.name === 'roofLine') {
currentObject.set({
- stroke: '#EA10AC',
+ stroke: LINE_COLOR.ACTIVE,
strokeWidth: 4,
})
}
@@ -35,17 +36,18 @@ export function useRoofLinePropertySetting(id, roof) {
roof.lines.forEach((line) => {
canvas.add(line)
line.set({
- stroke: '#000000',
+ stroke: LINE_COLOR.DEFAULT,
strokeWidth: 4,
visible: true,
+ name: 'roofLine',
})
line.bringToFront()
- // line.setViewLengthText(false)
})
canvas.renderAll()
}
const handleSetEaves = () => {
+ if (!currentObject) return
currentObject.set({
attributes: {
...currentObject.attributes,
@@ -60,6 +62,7 @@ export function useRoofLinePropertySetting(id, roof) {
}
const handleSetGable = () => {
+ if (!currentObject) return
currentObject.set({
attributes: {
...currentObject.attributes,
@@ -74,6 +77,7 @@ export function useRoofLinePropertySetting(id, roof) {
}
const handleSetRidge = () => {
+ if (!currentObject) return
currentObject.set({
attributes: {
...currentObject.attributes,
@@ -93,7 +97,11 @@ export function useRoofLinePropertySetting(id, roof) {
}
const lastLine = history.current.pop()
- delete lastLine.attributes
+ // delete lastLine.attributes
+ lastLine.attributes = {
+ ...lastLine.attributes,
+ type: null,
+ }
lastLine.set({
stroke: LINE_COLOR.DEFAULT,
strokeWidth: 4,