Merge branch 'dev' of https://git.jetbrains.space/nalpari/q-cast-iii/qcast-front into dev
This commit is contained in:
commit
12f12385b5
@ -119,30 +119,32 @@ export default function StepUp(props) {
|
||||
|
||||
// 새로운 모듈 회로 정보 추가
|
||||
roofSurface.moduleList.forEach((module) => {
|
||||
const targetModule = canvas.getObjects().filter((obj) => obj.id === module.uniqueId)[0]
|
||||
const moduleCircuitText = new fabric.Text(module.circuit, {
|
||||
left: targetModule.left + targetModule.width / 2,
|
||||
top: targetModule.top + targetModule.height / 2,
|
||||
fontFamily: circuitNumberText.fontFamily.value,
|
||||
fontWeight: circuitNumberText.fontWeight.value.toLowerCase().includes('bold') ? 'bold' : 'normal',
|
||||
fontStyle: circuitNumberText.fontWeight.value.toLowerCase().includes('italic') ? 'italic' : 'normal',
|
||||
fontSize: circuitNumberText.fontSize.value,
|
||||
fill: circuitNumberText.fontColor.value,
|
||||
width: targetModule.width,
|
||||
height: targetModule.height,
|
||||
textAlign: 'center',
|
||||
originX: 'center',
|
||||
originY: 'center',
|
||||
name: 'circuitNumber',
|
||||
parentId: targetModule.id,
|
||||
circuitInfo: module.pcsItemId,
|
||||
selectable: false,
|
||||
visible: isDisplayCircuitNumber,
|
||||
})
|
||||
targetModule.circuit = moduleCircuitText
|
||||
targetModule.pcsItemId = module.pcsItemId
|
||||
targetModule.circuitNumber = module.circuit
|
||||
canvas.add(moduleCircuitText)
|
||||
const targetModule = canvas.getObjects().find((obj) => obj.id === module.uniqueId)
|
||||
if (targetModule && module.circuit !== '' && module.circuit) {
|
||||
const moduleCircuitText = new fabric.Text(module.circuit, {
|
||||
left: targetModule.left + targetModule.width / 2,
|
||||
top: targetModule.top + targetModule.height / 2,
|
||||
fontFamily: circuitNumberText.fontFamily.value,
|
||||
fontWeight: circuitNumberText.fontWeight.value.toLowerCase().includes('bold') ? 'bold' : 'normal',
|
||||
fontStyle: circuitNumberText.fontWeight.value.toLowerCase().includes('italic') ? 'italic' : 'normal',
|
||||
fontSize: circuitNumberText.fontSize.value,
|
||||
fill: circuitNumberText.fontColor.value,
|
||||
width: targetModule.width,
|
||||
height: targetModule.height,
|
||||
textAlign: 'center',
|
||||
originX: 'center',
|
||||
originY: 'center',
|
||||
name: 'circuitNumber',
|
||||
parentId: targetModule.id,
|
||||
circuitInfo: module.pcsItemId,
|
||||
selectable: false,
|
||||
visible: isDisplayCircuitNumber,
|
||||
})
|
||||
targetModule.circuit = moduleCircuitText
|
||||
targetModule.pcsItemId = module.pcsItemId
|
||||
targetModule.circuitNumber = module.circuit
|
||||
canvas.add(moduleCircuitText)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
@ -441,8 +443,8 @@ export default function StepUp(props) {
|
||||
canvas.renderAll()
|
||||
|
||||
roofSurface.moduleList.forEach((module) => {
|
||||
const targetModule = canvas.getObjects().filter((obj) => obj.id === module.uniqueId)[0]
|
||||
if (module.circuit !== '' && module.circuit) {
|
||||
const targetModule = canvas.getObjects().find((obj) => obj.id === module.uniqueId)
|
||||
if (targetModule && module.circuit !== '' && module.circuit !== null) {
|
||||
const moduleCircuitText = new fabric.Text(module.circuit, {
|
||||
left: targetModule.left + targetModule.width / 2,
|
||||
top: targetModule.top + targetModule.height / 2,
|
||||
|
||||
@ -822,10 +822,7 @@ export function useModule() {
|
||||
|
||||
const alignModule = (type, surfaceArray) => {
|
||||
surfaceArray.forEach((surface) => {
|
||||
const modules = canvas
|
||||
.getObjects()
|
||||
.filter((module) => module.name === POLYGON_TYPE.MODULE)
|
||||
.filter((module) => module.surfaceId === surface.id)
|
||||
const modules = surface.modules
|
||||
|
||||
const objects = getObjects()
|
||||
let [top, bottom, left, right] = [0, 0, 0, 0]
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { useRecoilState, useRecoilValue, useSetRecoilState } from 'recoil'
|
||||
import { canvasState, currentMenuState, currentObjectState } from '@/store/canvasAtom'
|
||||
import { canvasSettingState, canvasState, currentMenuState, currentObjectState } from '@/store/canvasAtom'
|
||||
import { useEffect, useState } from 'react'
|
||||
import { MENU, POLYGON_TYPE } from '@/common/common'
|
||||
import AuxiliarySize from '@/components/floor-plan/modal/auxiliary/AuxiliarySize'
|
||||
@ -41,9 +41,11 @@ import { useGrid } from './common/useGrid'
|
||||
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'
|
||||
|
||||
export function useContextMenu() {
|
||||
const canvas = useRecoilValue(canvasState)
|
||||
const canvasSetting = useRecoilValue(canvasSettingState)
|
||||
const currentMenu = useRecoilValue(currentMenuState) // 현재 메뉴
|
||||
const setContextPopupPosition = useSetRecoilState(contextPopupPositionState) // 현재 메뉴
|
||||
const [contextMenu, setContextMenu] = useRecoilState(contextMenuListState) // 메뉴.object 별 context menu
|
||||
@ -263,54 +265,6 @@ export function useContextMenu() {
|
||||
],
|
||||
])
|
||||
break
|
||||
case MENU.BATCH_CANVAS.SLOPE_SETTING:
|
||||
case MENU.BATCH_CANVAS.BATCH_DRAWING:
|
||||
case MENU.BATCH_CANVAS.SURFACE_SHAPE_BATCH:
|
||||
case MENU.BATCH_CANVAS.OBJECT_BATCH:
|
||||
case MENU.BATCH_CANVAS.ALL_REMOVE:
|
||||
case MENU.BATCH_CANVAS.DEFAULT:
|
||||
setContextMenu([
|
||||
[
|
||||
{
|
||||
id: 'sizeEdit',
|
||||
name: getMessage('contextmenu.size.edit'),
|
||||
component: <SizeSetting id={popupId} target={currentObject} />,
|
||||
},
|
||||
{
|
||||
id: 'remove',
|
||||
shortcut: ['d', 'D'],
|
||||
name: `${getMessage('contextmenu.remove')}(D)`,
|
||||
},
|
||||
{
|
||||
id: 'move',
|
||||
shortcut: ['m', 'M'],
|
||||
name: `${getMessage('contextmenu.move')}(M)`,
|
||||
},
|
||||
{
|
||||
id: 'copy',
|
||||
shortcut: ['c', 'C'],
|
||||
name: `${getMessage('contextmenu.copy')}(C)`,
|
||||
},
|
||||
],
|
||||
[
|
||||
{
|
||||
id: 'roofMaterialEdit',
|
||||
name: getMessage('contextmenu.roof.material.edit'),
|
||||
component: <RoofAllocationSetting id={popupId} />,
|
||||
},
|
||||
{
|
||||
id: 'linePropertyEdit',
|
||||
name: getMessage('contextmenu.line.property.edit'),
|
||||
component: <LinePropertySetting id={popupId} />,
|
||||
},
|
||||
{
|
||||
id: 'flowDirectionEdit',
|
||||
name: getMessage('contextmenu.flow.direction.edit'),
|
||||
component: <FlowDirectionSetting id={popupId} target={currentObject} />,
|
||||
},
|
||||
],
|
||||
])
|
||||
break
|
||||
default:
|
||||
setContextMenu([])
|
||||
break
|
||||
@ -432,7 +386,14 @@ export function useContextMenu() {
|
||||
{
|
||||
id: 'linePropertyEdit',
|
||||
name: getMessage('contextmenu.line.property.edit'),
|
||||
component: <LinePropertySetting id={popupId} target={currentObject} />,
|
||||
fn: () => {
|
||||
if (+canvasSetting.roofSizeSet === 3) {
|
||||
swalFire({ text: getMessage('contextmenu.line.property.edit.roof.size.3') })
|
||||
} else {
|
||||
addPopup(popupId, 1, <PlacementSurfaceLineProperty id={popupId} roof={currentObject} />)
|
||||
}
|
||||
},
|
||||
// component: <LinePropertySetting id={popupId} target={currentObject} />,
|
||||
},
|
||||
{
|
||||
id: 'flowDirectionEdit',
|
||||
@ -740,24 +701,23 @@ export function useContextMenu() {
|
||||
])
|
||||
break
|
||||
case 'moduleSetupSurface':
|
||||
case 'roof':
|
||||
setContextMenu([
|
||||
[
|
||||
{
|
||||
id: 'moduleVerticalCenterAlign',
|
||||
name: getMessage('contextmenu.module.vertical.align'),
|
||||
fn: () => alignModule(MODULE_ALIGN_TYPE.VERTICAL, currentObject.arrayData),
|
||||
fn: () => alignModule(MODULE_ALIGN_TYPE.VERTICAL, currentObject.arrayData ?? [currentObject]),
|
||||
},
|
||||
{
|
||||
id: 'moduleHorizonCenterAlign',
|
||||
name: getMessage('contextmenu.module.horizon.align'),
|
||||
fn: () => alignModule(MODULE_ALIGN_TYPE.HORIZONTAL, currentObject.arrayData),
|
||||
fn: () => alignModule(MODULE_ALIGN_TYPE.HORIZONTAL, currentObject.arrayData ?? [currentObject]),
|
||||
},
|
||||
{
|
||||
id: 'moduleRemove',
|
||||
name: getMessage('contextmenu.module.remove'),
|
||||
fn: () => {
|
||||
moduleRoofRemove(currentObject.arrayData)
|
||||
moduleRoofRemove(currentObject.arrayData ?? [currentObject])
|
||||
|
||||
// const moduleSetupSurface = canvas.getObjects().filter((obj) => canvas.getActiveObjects()[0].id === obj.id)[0]
|
||||
// const modules = canvas.getObjects().filter((obj) => obj.surfaceId === moduleSetupSurface.id && obj.name === POLYGON_TYPE.MODULE)
|
||||
@ -768,12 +728,12 @@ export function useContextMenu() {
|
||||
{
|
||||
id: 'moduleMove',
|
||||
name: getMessage('contextmenu.module.move'),
|
||||
component: <PanelEdit id={popupId} type={PANEL_EDIT_TYPE.MOVE_ALL} arrayData={currentObject.arrayData} />,
|
||||
component: <PanelEdit id={popupId} type={PANEL_EDIT_TYPE.MOVE_ALL} arrayData={currentObject.arrayData ?? [currentObject]} />,
|
||||
},
|
||||
{
|
||||
id: 'moduleCopy',
|
||||
name: getMessage('contextmenu.module.copy'),
|
||||
component: <PanelEdit id={popupId} type={PANEL_EDIT_TYPE.COPY_ALL} arrayData={currentObject.arrayData} />,
|
||||
component: <PanelEdit id={popupId} type={PANEL_EDIT_TYPE.COPY_ALL} arrayData={currentObject.arrayData ?? [currentObject]} />,
|
||||
},
|
||||
// {
|
||||
// id: 'moduleCircuitNumberEdit',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user