diff --git a/src/hooks/module/useModule.js b/src/hooks/module/useModule.js
index 49fef2be..0896fe04 100644
--- a/src/hooks/module/useModule.js
+++ b/src/hooks/module/useModule.js
@@ -536,7 +536,6 @@ export function useModule() {
const moduleRowRemove = (type) => {
const activeModule = canvas.getObjects().filter((obj) => canvas.getActiveObjects()[0].id === obj.id)[0]
- c
const rowModules = getRowModules(activeModule)
const otherModules = getOtherModules(rowModules)
const objects = getObjects()
diff --git a/src/hooks/roofcover/useRoofAllocationSetting.js b/src/hooks/roofcover/useRoofAllocationSetting.js
index 93f51514..671d4c7e 100644
--- a/src/hooks/roofcover/useRoofAllocationSetting.js
+++ b/src/hooks/roofcover/useRoofAllocationSetting.js
@@ -239,7 +239,7 @@ export function useRoofAllocationSetting(id) {
*/
const onAddRoofMaterial = () => {
if (currentRoofList.length >= 4) {
- swalFire({ type: 'alert', icon: 'error', text: getMessage('지붕재는 4개까지 선택 가능합니다.') })
+ swalFire({ type: 'alert', icon: 'error', text: getMessage('roof.exceed.count') })
return
}
setCurrentRoofList([
@@ -289,7 +289,7 @@ export function useRoofAllocationSetting(id) {
const handleSaveContext = () => {
basicSettingSave()
const newRoofList = currentRoofList.map((roof, idx) => {
- return { ...roof, index: idx }
+ return { ...roof, index: idx, raft: roof.raft ? roof.raft : roof.raftBaseCd }
})
setBasicSetting((prev) => {
return {
@@ -379,7 +379,7 @@ export function useRoofAllocationSetting(id) {
/** 데이터 설정 */
const newRoofList = currentRoofList.map((roof, idx) => {
- return { ...roof, index: idx, ...basicInfo }
+ return { ...roof, index: idx, ...basicInfo, raft: roof.raft ? roof.raft : roof.raftBaseCd }
})
setBasicSetting((prev) => {
diff --git a/src/hooks/useContextMenu.js b/src/hooks/useContextMenu.js
index f1cb43e4..97e9cf6c 100644
--- a/src/hooks/useContextMenu.js
+++ b/src/hooks/useContextMenu.js
@@ -42,6 +42,7 @@ import { useAdsorptionPoint } from './useAdsorptionPoint'
import { useRoofFn } from '@/hooks/common/useRoofFn'
import { MODULE_ALIGN_TYPE, useModule } from './module/useModule'
import PlacementSurfaceLineProperty from '@/components/floor-plan/modal/placementShape/PlacementSurfaceLineProperty'
+import { selectedMenuState } from '@/store/menuAtom'
export function useContextMenu() {
const canvas = useRecoilValue(canvasState)
@@ -71,10 +72,11 @@ export function useContextMenu() {
const { swalFire } = useSwal()
const { alignModule, modulesRemove, moduleRoofRemove } = useModule()
const { removeRoofMaterial, removeAllRoofMaterial, moveRoofMaterial, removeOuterLines } = useRoofFn()
+ const selectedMenu = useRecoilValue(selectedMenuState)
const currentMenuSetting = () => {
- switch (currentMenu) {
- case MENU.PLAN_DRAWING:
+ switch (selectedMenu) {
+ case 'placement':
setContextMenu([
[
{
@@ -115,155 +117,9 @@ export function useContextMenu() {
],
])
break
- case MENU.ROOF_COVERING.EXTERIOR_WALL_LINE:
- case MENU.ROOF_COVERING.ROOF_SHAPE_SETTINGS:
- case MENU.ROOF_COVERING.ROOF_SHAPE_PASSIVITY_SETTINGS:
- case MENU.ROOF_COVERING.ROOF_SHAPE_EDITING:
- case MENU.ROOF_COVERING.HELP_LINE_DRAWING:
- case MENU.ROOF_COVERING.EAVES_KERAVA_EDIT:
- case MENU.ROOF_COVERING.MOVEMENT_SHAPE_UPDOWN:
- case MENU.ROOF_COVERING.OUTLINE_EDIT_OFFSET:
- case MENU.ROOF_COVERING.ROOF_SHAPE_ALLOC:
- case MENU.ROOF_COVERING.DEFAULT:
- setContextMenu([
- [
- {
- id: 'roofMaterialPlacement',
- name: getMessage('contextmenu.roof.material.placement'),
- component: ,
- },
-
- {
- id: 'roofMaterialRemoveAll',
- name: getMessage('contextmenu.roof.material.remove.all'),
- fn: () => removeAllRoofMaterial(),
- },
- {
- id: 'selectMove',
- name: getMessage('contextmenu.select.move'),
- fn: (currentMousePos) => {
- moveRoofMaterial(currentMousePos)
- },
- },
- {
- id: 'wallLineRemove',
- name: getMessage('contextmenu.wallline.remove'),
- fn: (currentMousePos) => {
- removeOuterLines(currentMousePos)
- },
- },
- ],
- [
- {
- id: 'sizeEdit',
- name: getMessage('contextmenu.size.edit'),
- component: ,
- },
- {
- id: 'auxiliaryMove',
- name: `${getMessage('contextmenu.auxiliary.move')}(M)`,
- shortcut: ['m', 'M'],
- component: ,
- },
- {
- id: 'auxiliaryCopy',
- name: `${getMessage('contextmenu.auxiliary.copy')}(C)`,
- shortcut: ['c', 'C'],
- component: ,
- },
- {
- id: 'auxiliaryRemove',
- shortcut: ['d', 'D'],
- name: `${getMessage('contextmenu.auxiliary.remove')}(D)`,
- fn: () => {
- if (!currentObject) return
- const roof = canvas.getObjects().filter((obj) => obj.id === currentObject.attributes.roofId)[0]
- if (!roof) {
- // 아직 innerLines로 세팅이 안되어있는 line인 경우 제거
- canvas.remove(currentObject)
- canvas.discardActiveObject()
- return
- }
- const innerLines = roof.innerLines?.filter((line) => currentObject.id !== line.id)
- roof.innerLines = [...innerLines]
- canvas.remove(currentObject)
- canvas.discardActiveObject()
- },
- },
- {
- id: 'auxiliaryVerticalBisector',
- name: getMessage('contextmenu.auxiliary.vertical.bisector'),
- fn: () => {
- if (!currentObject) return
- const slope = (currentObject.y2 - currentObject.y1) / (currentObject.x2 - currentObject.x1)
- const length = currentObject.length
-
- let startX, startY, endX, endY
- if (slope === 0) {
- startX = endX = (currentObject.x1 + currentObject.x2) / 2
- startY = currentObject.y2 - length / 2
- endY = currentObject.y2 + length / 2
- } else if (slope === Infinity) {
- startX = currentObject.x1 - length / 2
- startY = endY = (currentObject.y1 + currentObject.y2) / 2
- endX = currentObject.x1 + length / 2
- } else {
- const bisectorSlope = -1 / slope
- const dx = length / 2 / Math.sqrt(1 + bisectorSlope * bisectorSlope)
- const dy = bisectorSlope * dx
-
- startX = (currentObject.x1 + currentObject.x2) / 2 + dx
- startY = (currentObject.y1 + currentObject.y2) / 2 + dy
- endX = (currentObject.x1 + currentObject.x2) / 2 - dx
- endY = (currentObject.y1 + currentObject.y2) / 2 - dy
- }
-
- const line = addLine([startX, startY, endX, endY], {
- stroke: 'red',
- strokeWidth: 1,
- selectable: true,
- name: 'auxiliaryLine',
- attributes: { ...currentObject.attributes },
- })
-
- if (!currentObject.attributes.roofId) {
- return
- }
-
- canvas
- .getObjects()
- .filter((obj) => obj.id === currentObject.attributes.roofId)[0]
- .innerLines.push(line)
- },
- },
- {
- id: 'auxiliaryRemoveAll',
- name: getMessage('contextmenu.auxiliary.remove.all'),
- fn: () => {
- if (!currentObject) {
- swalFire({ text: getMessage('roof.is.not.selected') })
- return
- }
- const innerLines = canvas.getObjects().filter((obj) => obj.id === currentObject.attributes.roofId)[0]?.innerLines
- if (innerLines) {
- innerLines.forEach((line) => {
- canvas.remove(line)
- })
- innerLines.length = 0
- }
-
- // 확정되지 않은 보조선
- const notFixedAuxiliaryLines = canvas.getObjects().filter((obj) => obj.name === 'auxiliaryLine' && !obj.isAuxiliaryFixed)
-
- notFixedAuxiliaryLines.forEach((line) => {
- canvas.remove(line)
- })
-
- canvas.renderAll()
- },
- },
- ],
- ])
+ case 'outline':
+ if (['roof', 'auxiliaryLine'].includes(currentObject?.name)) {
+ }
break
default:
setContextMenu([])
@@ -312,96 +168,244 @@ export function useContextMenu() {
switch (currentObject.name) {
case 'triangleDormer':
case 'pentagonDormer':
- setContextMenu([
- [
- {
- id: 'sizeEdit',
- name: getMessage('contextmenu.size.edit'),
- component: ,
- },
- {
- id: 'dormerRemove',
- shortcut: ['d', 'D'],
- name: `${getMessage('contextmenu.remove')}(D)`,
- fn: () => deleteObject(),
- },
- {
- id: 'dormerMove',
- shortcut: ['m', 'M'],
- name: `${getMessage('contextmenu.move')}(M)`,
- fn: () => moveObjectBatch(),
- },
- {
- id: 'dormerCopy',
- shortcut: ['c', 'C'],
- name: `${getMessage('contextmenu.copy')}(C)`,
- fn: () => copyObject(),
- },
- {
- id: 'roofMaterialEdit',
- name: getMessage('contextmenu.roof.material.edit'),
- component: ,
- },
- {
- id: 'dormerOffset',
- name: getMessage('contextmenu.dormer.offset'),
- component: ,
- },
- ],
- ])
+ if (selectedMenu === 'surface') {
+ setContextMenu([
+ [
+ {
+ id: 'sizeEdit',
+ name: getMessage('contextmenu.size.edit'),
+ component: ,
+ },
+ {
+ id: 'dormerRemove',
+ shortcut: ['d', 'D'],
+ name: `${getMessage('contextmenu.remove')}(D)`,
+ fn: () => deleteObject(),
+ },
+ {
+ id: 'dormerMove',
+ shortcut: ['m', 'M'],
+ name: `${getMessage('contextmenu.move')}(M)`,
+ fn: () => moveObjectBatch(),
+ },
+ {
+ id: 'dormerCopy',
+ shortcut: ['c', 'C'],
+ name: `${getMessage('contextmenu.copy')}(C)`,
+ fn: () => copyObject(),
+ },
+ {
+ id: 'roofMaterialEdit',
+ name: getMessage('contextmenu.roof.material.edit'),
+ component: ,
+ },
+ {
+ id: 'dormerOffset',
+ name: getMessage('contextmenu.dormer.offset'),
+ component: ,
+ },
+ ],
+ ])
+ }
break
case 'roof':
- setContextMenu([
- [
- {
- id: 'sizeEdit',
- name: getMessage('contextmenu.size.edit'),
- component: ,
- },
- {
- id: 'roofMaterialRemove',
- shortcut: ['d', 'D'],
- name: `${getMessage('contextmenu.remove')}(D)`,
- fn: () => deleteObject(),
- },
- {
- id: 'roofMaterialMove',
- shortcut: ['m', 'M'],
- name: `${getMessage('contextmenu.move')}(M)`,
- fn: () => moveSurfaceShapeBatch(),
- },
- {
- id: 'roofMaterialCopy',
- shortcut: ['c', 'C'],
- name: `${getMessage('contextmenu.copy')}(C)`,
- fn: () => copyObject(),
- },
- ],
- [
- {
- id: 'roofMaterialEdit',
- name: getMessage('contextmenu.roof.material.edit'),
- component: ,
- },
- {
- id: 'linePropertyEdit',
- name: getMessage('contextmenu.line.property.edit'),
- fn: () => {
- if (+canvasSetting.roofSizeSet === 3) {
- swalFire({ text: getMessage('contextmenu.line.property.edit.roof.size.3') })
- } else {
- addPopup(popupId, 1, )
- }
+ case 'auxiliaryLine':
+ case 'hip':
+ case 'ridge':
+ if (selectedMenu === 'surface') {
+ setContextMenu([
+ [
+ {
+ id: 'sizeEdit',
+ name: getMessage('contextmenu.size.edit'),
+ component: ,
},
- // component: ,
- },
- {
- id: 'flowDirectionEdit',
- name: getMessage('contextmenu.flow.direction.edit'),
- component: ,
- },
- ],
- ])
+ {
+ id: 'roofMaterialRemove',
+ shortcut: ['d', 'D'],
+ name: `${getMessage('contextmenu.remove')}(D)`,
+ fn: () => deleteObject(),
+ },
+ {
+ id: 'roofMaterialMove',
+ shortcut: ['m', 'M'],
+ name: `${getMessage('contextmenu.move')}(M)`,
+ fn: () => moveSurfaceShapeBatch(),
+ },
+ {
+ id: 'roofMaterialCopy',
+ shortcut: ['c', 'C'],
+ name: `${getMessage('contextmenu.copy')}(C)`,
+ fn: () => copyObject(),
+ },
+ ],
+ [
+ {
+ id: 'roofMaterialEdit',
+ name: getMessage('contextmenu.roof.material.edit'),
+ component: ,
+ },
+ {
+ id: 'linePropertyEdit',
+ name: getMessage('contextmenu.line.property.edit'),
+ fn: () => {
+ if (+canvasSetting.roofSizeSet === 3) {
+ swalFire({ text: getMessage('contextmenu.line.property.edit.roof.size.3') })
+ } else {
+ addPopup(popupId, 1, )
+ }
+ },
+ // component: ,
+ },
+ {
+ id: 'flowDirectionEdit',
+ name: getMessage('contextmenu.flow.direction.edit'),
+ component: ,
+ },
+ ],
+ ])
+ } else if (selectedMenu === 'outline') {
+ setContextMenu([
+ [
+ {
+ id: 'roofMaterialPlacement',
+ name: getMessage('contextmenu.roof.material.placement'),
+ component: ,
+ },
+
+ {
+ id: 'roofMaterialRemoveAll',
+ name: getMessage('contextmenu.roof.material.remove.all'),
+ fn: () => removeAllRoofMaterial(),
+ },
+ {
+ id: 'selectMove',
+ name: getMessage('contextmenu.select.move'),
+ fn: (currentMousePos) => {
+ moveRoofMaterial(currentMousePos)
+ },
+ },
+ {
+ id: 'wallLineRemove',
+ name: getMessage('contextmenu.wallline.remove'),
+ fn: (currentMousePos) => {
+ removeOuterLines(currentMousePos)
+ },
+ },
+ ],
+ [
+ {
+ id: 'sizeEdit',
+ name: getMessage('contextmenu.size.edit'),
+ component: ,
+ },
+ {
+ id: 'auxiliaryMove',
+ name: `${getMessage('contextmenu.auxiliary.move')}(M)`,
+ shortcut: ['m', 'M'],
+ component: ,
+ },
+ {
+ id: 'auxiliaryCopy',
+ name: `${getMessage('contextmenu.auxiliary.copy')}(C)`,
+ shortcut: ['c', 'C'],
+ component: ,
+ },
+ {
+ id: 'auxiliaryRemove',
+ shortcut: ['d', 'D'],
+ name: `${getMessage('contextmenu.auxiliary.remove')}(D)`,
+ fn: () => {
+ if (!currentObject) return
+ const roof = canvas.getObjects().filter((obj) => obj.id === currentObject.attributes.roofId)[0]
+ if (!roof) {
+ // 아직 innerLines로 세팅이 안되어있는 line인 경우 제거
+ canvas.remove(currentObject)
+ canvas.discardActiveObject()
+ return
+ }
+ const innerLines = roof.innerLines?.filter((line) => currentObject.id !== line.id)
+ roof.innerLines = [...innerLines]
+ canvas.remove(currentObject)
+ canvas.discardActiveObject()
+ },
+ },
+ {
+ id: 'auxiliaryVerticalBisector',
+ name: getMessage('contextmenu.auxiliary.vertical.bisector'),
+ fn: () => {
+ if (!currentObject) return
+ const slope = (currentObject.y2 - currentObject.y1) / (currentObject.x2 - currentObject.x1)
+ const length = currentObject.length
+
+ let startX, startY, endX, endY
+ if (slope === 0) {
+ startX = endX = (currentObject.x1 + currentObject.x2) / 2
+ startY = currentObject.y2 - length / 2
+ endY = currentObject.y2 + length / 2
+ } else if (slope === Infinity) {
+ startX = currentObject.x1 - length / 2
+ startY = endY = (currentObject.y1 + currentObject.y2) / 2
+ endX = currentObject.x1 + length / 2
+ } else {
+ const bisectorSlope = -1 / slope
+ const dx = length / 2 / Math.sqrt(1 + bisectorSlope * bisectorSlope)
+ const dy = bisectorSlope * dx
+
+ startX = (currentObject.x1 + currentObject.x2) / 2 + dx
+ startY = (currentObject.y1 + currentObject.y2) / 2 + dy
+ endX = (currentObject.x1 + currentObject.x2) / 2 - dx
+ endY = (currentObject.y1 + currentObject.y2) / 2 - dy
+ }
+
+ const line = addLine([startX, startY, endX, endY], {
+ stroke: 'red',
+ strokeWidth: 1,
+ selectable: true,
+ name: 'auxiliaryLine',
+ attributes: { ...currentObject.attributes },
+ })
+
+ if (!currentObject.attributes.roofId) {
+ return
+ }
+
+ canvas
+ .getObjects()
+ .filter((obj) => obj.id === currentObject.attributes.roofId)[0]
+ .innerLines.push(line)
+ },
+ },
+ {
+ id: 'auxiliaryRemoveAll',
+ name: getMessage('contextmenu.auxiliary.remove.all'),
+ fn: () => {
+ if (!currentObject) {
+ swalFire({ text: getMessage('roof.is.not.selected') })
+ return
+ }
+ const innerLines = canvas.getObjects().filter((obj) => obj.id === currentObject.attributes.roofId)[0]?.innerLines
+ if (innerLines) {
+ innerLines.forEach((line) => {
+ canvas.remove(line)
+ })
+ innerLines.length = 0
+ }
+
+ // 확정되지 않은 보조선
+ const notFixedAuxiliaryLines = canvas.getObjects().filter((obj) => obj.name === 'auxiliaryLine' && !obj.isAuxiliaryFixed)
+
+ notFixedAuxiliaryLines.forEach((line) => {
+ canvas.remove(line)
+ })
+
+ canvas.renderAll()
+ },
+ },
+ ],
+ ])
+ }
+
break
case 'opening':
setContextMenu([
diff --git a/src/locales/ja.json b/src/locales/ja.json
index 52ebfeba..76f16b36 100644
--- a/src/locales/ja.json
+++ b/src/locales/ja.json
@@ -294,9 +294,9 @@
"modal.object.setting.size.setting": "サイズ設定",
"modal.object.setting.agreement.depth": "棟の長さ・深さ",
"modal.object.setting.offset.depth": "出幅(深さ)",
- "modal.object.setting.size.width": "",
+ "modal.object.setting.size.width": "幅",
"modal.object.setting.offset.width": "出幅(幅)",
- "modal.object.setting.offset.slope": "",
+ "modal.object.setting.offset.slope": "勾配",
"modal.object.setting.direction.select": "方向の選択",
"modal.placement.surface.setting.info": "ⓘ①の長さ入力後、対角線長を入力すると②の長さを自動計算します。",
"modal.placement.surface.setting.diagonal.length": "斜めの長さ",
@@ -1015,8 +1015,8 @@
"module.place.select.one.module": "モジュールは1つだけ選択してください。",
"batch.canvas.delete.all": "配置面の内容をすべて削除しますか?",
"module.not.found": "インストールモジュールを選択してください。",
- "module.circuit.minimun.error": "",
- "module.already.exist.error": "",
+ "module.circuit.minimun.error": "회로번호는 1 이상입력해주세요.(JA)",
+ "module.already.exist.error": "회로번호가 같은 다른 파워 컨디셔너 모듈이 있습니다. 다른 회로번호를 설정하십시오.(JA)",
"construction.length.difference": "屋根面工法をすべて選択してください。",
"menu.validation.canvas.roof": "パネルを配置するには、屋根面を入力する必要があります。",
"batch.object.outside.roof": "オブジェクトは屋根に設置する必要があります。",
@@ -1028,5 +1028,6 @@
"not.allocation.exist.module": "回路を割り当てていないモジュールがあります。",
"roof.is.not.selected": "屋根の選択をお願いします。",
"length.direction.is.required": "長さと方向を入力します。",
- "canvas.infomation.text": "数字は [半角] 入力のみ可能です。"
+ "canvas.infomation.text": "数字は [半角] 入力のみ可能です。",
+ "roof.exceed.count": "屋根材は4つまで選択可能です。"
}
diff --git a/src/locales/ko.json b/src/locales/ko.json
index eb853d83..0a1119d0 100644
--- a/src/locales/ko.json
+++ b/src/locales/ko.json
@@ -1028,5 +1028,6 @@
"not.allocation.exist.module": "회로를 할당하지 않은 모듈이 있습니다.",
"roof.is.not.selected": "지붕을 선택해주세요.",
"length.direction.is.required": "길이와 방향을 입력하세요.",
- "canvas.infomation.text": "숫자는 [반각] 입력만 가능합니다."
+ "canvas.infomation.text": "숫자는 [반각] 입력만 가능합니다.",
+ "roof.exceed.count": "지붕재는 4개까지 선택 가능합니다."
}