Merge branch 'dev' of ssh://git.jetbrains.space/nalpari/q-cast-iii/qcast-front into dev
This commit is contained in:
commit
25c30f00c3
@ -72,7 +72,7 @@ export default function BasicSetting({ id, pos = { x: 50, y: 230 } }) {
|
|||||||
|
|
||||||
const placementRef = {
|
const placementRef = {
|
||||||
isChidori: useRef('false'),
|
isChidori: useRef('false'),
|
||||||
setupLocation: useRef('center'),
|
setupLocation: useRef('eaves'),
|
||||||
isMaxSetup: useRef('false'),
|
isMaxSetup: useRef('false'),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1538,7 +1538,6 @@ export default function StuffDetail() {
|
|||||||
setFloorPlanObjectNo({ floorPlanObjectNo: '' })
|
setFloorPlanObjectNo({ floorPlanObjectNo: '' })
|
||||||
del({ url: `/api/object/${objectNo}?${queryStringFormatter(delParams)}` })
|
del({ url: `/api/object/${objectNo}?${queryStringFormatter(delParams)}` })
|
||||||
.then(() => {
|
.then(() => {
|
||||||
console.log('트루555')
|
|
||||||
setIsGlobalLoading(true)
|
setIsGlobalLoading(true)
|
||||||
setFloorPlanObjectNo({ floorPlanObjectNo: '' })
|
setFloorPlanObjectNo({ floorPlanObjectNo: '' })
|
||||||
if (session.storeId === 'T01') {
|
if (session.storeId === 'T01') {
|
||||||
@ -1661,9 +1660,6 @@ export default function StuffDetail() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('물건등로고하면::', otherSaleStoreList)
|
|
||||||
console.log('물건등로고하면::', otherSaleStoreList.length)
|
|
||||||
//"201X584"
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{(editMode === 'NEW' && (
|
{(editMode === 'NEW' && (
|
||||||
|
|||||||
@ -800,60 +800,65 @@ export function useModule() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const alignModule = (type) => {
|
const alignModule = (type, surfaceArray) => {
|
||||||
const moduleSetupSurface = canvas.getObjects().filter((obj) => canvas.getActiveObjects()[0].id === obj.id)[0]
|
surfaceArray.forEach((surface) => {
|
||||||
const modules = canvas.getObjects().filter((obj) => obj.surfaceId === moduleSetupSurface.id && obj.name === POLYGON_TYPE.MODULE)
|
const modules = canvas
|
||||||
const objects = getObjects()
|
.getObjects()
|
||||||
let [top, bottom, left, right] = [0, 0, 0, 0]
|
.filter((module) => module.name === POLYGON_TYPE.MODULE)
|
||||||
|
.filter((module) => module.surfaceId === surface.id)
|
||||||
|
|
||||||
top = Math.min(...modules.map((module) => module.top))
|
const objects = getObjects()
|
||||||
bottom = Math.max(...modules.map((module) => module.top + module.height))
|
let [top, bottom, left, right] = [0, 0, 0, 0]
|
||||||
left = Math.min(...modules.map((module) => module.left))
|
|
||||||
right = Math.max(...modules.map((module) => module.left + module.width))
|
|
||||||
const moduleSurfacePos = {
|
|
||||||
top: Math.min(...moduleSetupSurface.points.map((point) => point.y)),
|
|
||||||
left: Math.min(...moduleSetupSurface.points.map((point) => point.x)),
|
|
||||||
}
|
|
||||||
const [height, width] = [bottom - top, right - left]
|
|
||||||
const verticalCenterLength = moduleSurfacePos.top + moduleSetupSurface.height / 2 - (top + height / 2)
|
|
||||||
const horizontalCenterLength = moduleSurfacePos.left + moduleSetupSurface.width / 2 - (left + width / 2)
|
|
||||||
let isWarning = false
|
|
||||||
|
|
||||||
canvas.discardActiveObject()
|
top = Math.min(...modules.map((module) => module.top))
|
||||||
modules.forEach((module) => {
|
bottom = Math.max(...modules.map((module) => module.top + module.height))
|
||||||
module.originPos = {
|
left = Math.min(...modules.map((module) => module.left))
|
||||||
left: module.left,
|
right = Math.max(...modules.map((module) => module.left + module.width))
|
||||||
top: module.top,
|
const moduleSurfacePos = {
|
||||||
fill: module.fill,
|
top: Math.min(...surface.points.map((point) => point.y)),
|
||||||
}
|
left: Math.min(...surface.points.map((point) => point.x)),
|
||||||
if (type === MODULE_ALIGN_TYPE.VERTICAL) {
|
|
||||||
module.set({ top: module.top + verticalCenterLength })
|
|
||||||
} else if (type === MODULE_ALIGN_TYPE.HORIZONTAL) {
|
|
||||||
module.set({ left: module.left + horizontalCenterLength })
|
|
||||||
}
|
}
|
||||||
|
const [height, width] = [bottom - top, right - left]
|
||||||
|
const verticalCenterLength = moduleSurfacePos.top + surface.height / 2 - (top + height / 2)
|
||||||
|
const horizontalCenterLength = moduleSurfacePos.left + surface.width / 2 - (left + width / 2)
|
||||||
|
let isWarning = false
|
||||||
|
|
||||||
|
canvas.discardActiveObject()
|
||||||
|
modules.forEach((module) => {
|
||||||
|
module.originPos = {
|
||||||
|
left: module.left,
|
||||||
|
top: module.top,
|
||||||
|
fill: module.fill,
|
||||||
|
}
|
||||||
|
if (type === MODULE_ALIGN_TYPE.VERTICAL) {
|
||||||
|
module.set({ top: module.top + verticalCenterLength })
|
||||||
|
} else if (type === MODULE_ALIGN_TYPE.HORIZONTAL) {
|
||||||
|
module.set({ left: module.left + horizontalCenterLength })
|
||||||
|
}
|
||||||
|
|
||||||
|
canvas.renderAll()
|
||||||
|
module.setCoords()
|
||||||
|
if (isOverlapObjects(module, objects) || isOutsideSurface(module, surface)) {
|
||||||
|
isWarning = true
|
||||||
|
module.set({ fill: 'red' })
|
||||||
|
}
|
||||||
|
})
|
||||||
canvas.renderAll()
|
canvas.renderAll()
|
||||||
module.setCoords()
|
if (isWarning) {
|
||||||
if (isOverlapObjects(module, objects) || isOutsideSurface(module, moduleSetupSurface)) {
|
swalFire({
|
||||||
isWarning = true
|
title: getMessage('can.not.align.module'),
|
||||||
module.set({ fill: 'red' })
|
icon: 'error',
|
||||||
|
type: 'alert',
|
||||||
|
confirmFn: () => {
|
||||||
|
modules.forEach((module) => {
|
||||||
|
module.set({ top: module.originPos.top, left: module.originPos.left, fill: module.originPos.fill })
|
||||||
|
module.setCoords()
|
||||||
|
})
|
||||||
|
canvas.renderAll()
|
||||||
|
},
|
||||||
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
canvas.renderAll()
|
|
||||||
if (isWarning) {
|
|
||||||
swalFire({
|
|
||||||
title: getMessage('can.not.align.module'),
|
|
||||||
icon: 'error',
|
|
||||||
type: 'alert',
|
|
||||||
confirmFn: () => {
|
|
||||||
modules.forEach((module) => {
|
|
||||||
module.set({ top: module.originPos.top, left: module.originPos.left, fill: module.originPos.fill })
|
|
||||||
module.setCoords()
|
|
||||||
})
|
|
||||||
canvas.renderAll()
|
|
||||||
},
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const modulesRemove = () => {
|
const modulesRemove = () => {
|
||||||
@ -867,6 +872,19 @@ export function useModule() {
|
|||||||
canvas.renderAll()
|
canvas.renderAll()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const moduleRoofRemove = (surfaceArray) => {
|
||||||
|
surfaceArray.forEach((surface) => {
|
||||||
|
surface.modules = []
|
||||||
|
canvas
|
||||||
|
.getObjects()
|
||||||
|
.filter((module) => module.name === POLYGON_TYPE.MODULE && module.surfaceId === surface.id)
|
||||||
|
.forEach((module) => {
|
||||||
|
canvas.remove(module)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
setModuleStatisticsData()
|
||||||
|
}
|
||||||
|
|
||||||
const isOverlapOtherModules = (module, otherModules) => {
|
const isOverlapOtherModules = (module, otherModules) => {
|
||||||
return otherModules.some(
|
return otherModules.some(
|
||||||
(otherModule) =>
|
(otherModule) =>
|
||||||
@ -1031,6 +1049,7 @@ export function useModule() {
|
|||||||
moduleColumnInsert,
|
moduleColumnInsert,
|
||||||
muduleRowInsert,
|
muduleRowInsert,
|
||||||
modulesRemove,
|
modulesRemove,
|
||||||
|
moduleRoofRemove,
|
||||||
alignModule,
|
alignModule,
|
||||||
setModuleStatisticsData,
|
setModuleStatisticsData,
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
import { useState } from 'react'
|
import { useState } from 'react'
|
||||||
import { useRecoilState, useRecoilValue, useSetRecoilState } from 'recoil'
|
import { useRecoilState, useRecoilValue, useSetRecoilState } from 'recoil'
|
||||||
import { canvasSettingState, canvasState, checkedModuleState, isManualModuleSetupState } from '@/store/canvasAtom'
|
import { canvasSettingState, canvasState, checkedModuleState, currentObjectState, isManualModuleSetupState } from '@/store/canvasAtom'
|
||||||
import { rectToPolygon, polygonToTurfPolygon, calculateVisibleModuleHeight, getDegreeByChon } from '@/util/canvas-util'
|
import { rectToPolygon, polygonToTurfPolygon, calculateVisibleModuleHeight, getDegreeByChon } from '@/util/canvas-util'
|
||||||
import { basicSettingState, roofDisplaySelector } from '@/store/settingAtom'
|
import { addedRoofsState, basicSettingState, roofDisplaySelector } from '@/store/settingAtom'
|
||||||
import offsetPolygon, { calculateAngle } from '@/util/qpolygon-utils'
|
import offsetPolygon, { calculateAngle } from '@/util/qpolygon-utils'
|
||||||
import { QPolygon } from '@/components/fabric/QPolygon'
|
import { QPolygon } from '@/components/fabric/QPolygon'
|
||||||
import { moduleSetupSurfaceState, moduleIsSetupState } from '@/store/canvasAtom'
|
import { moduleSetupSurfaceState, moduleIsSetupState } from '@/store/canvasAtom'
|
||||||
@ -45,14 +45,14 @@ export function useModuleBasicSetting(tabNum) {
|
|||||||
const { getTrestleDetailList } = useMasterController()
|
const { getTrestleDetailList } = useMasterController()
|
||||||
const [saleStoreNorthFlg, setSaleStoreNorthFlg] = useState(false)
|
const [saleStoreNorthFlg, setSaleStoreNorthFlg] = useState(false)
|
||||||
|
|
||||||
|
const [currentObject, setCurrentObject] = useRecoilState(currentObjectState)
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// console.log('basicSetting', basicSetting)
|
// console.log('basicSetting', basicSetting)
|
||||||
if (canvas) {
|
if (canvas) {
|
||||||
canvas.selection = true
|
//드래그 여부
|
||||||
canvas.selectionFullyContained = true
|
// canvas.selection = true
|
||||||
// canvas.on('selection:created', (e) => {
|
// canvas.selectionFullyContained = true
|
||||||
// console.log('selection:created', e.selected)
|
|
||||||
// })
|
|
||||||
}
|
}
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
@ -191,7 +191,7 @@ export function useModuleBasicSetting(tabNum) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
let offsetLength = canvasSetting.roofSizeSet === 3 ? -90 : (trestleDetail.eaveIntvl / 10) * -1
|
let offsetLength = canvasSetting.roofSizeSet === '3' ? -90 : (trestleDetail.eaveIntvl / 10) * -1
|
||||||
setSurfaceShapePattern(roof, roofDisplay.column, true) //패턴 변경
|
setSurfaceShapePattern(roof, roofDisplay.column, true) //패턴 변경
|
||||||
const offsetPoints = offsetPolygon(roof.points, offsetLength) //안쪽 offset
|
const offsetPoints = offsetPolygon(roof.points, offsetLength) //안쪽 offset
|
||||||
//모듈설치영역?? 생성
|
//모듈설치영역?? 생성
|
||||||
@ -258,8 +258,6 @@ export function useModuleBasicSetting(tabNum) {
|
|||||||
|
|
||||||
//설치 범위 지정 클릭 이벤트
|
//설치 범위 지정 클릭 이벤트
|
||||||
const toggleSelection = (setupSurface) => {
|
const toggleSelection = (setupSurface) => {
|
||||||
console.log('setupSurface', setupSurface)
|
|
||||||
|
|
||||||
const isExist = selectedModuleInstSurfaceArray.some((obj) => obj.parentId === setupSurface.parentId)
|
const isExist = selectedModuleInstSurfaceArray.some((obj) => obj.parentId === setupSurface.parentId)
|
||||||
//최초 선택일때
|
//최초 선택일때
|
||||||
if (!isExist) {
|
if (!isExist) {
|
||||||
@ -281,6 +279,7 @@ export function useModuleBasicSetting(tabNum) {
|
|||||||
|
|
||||||
canvas?.renderAll()
|
canvas?.renderAll()
|
||||||
selectedModuleInstSurfaceArray.push(setupSurface)
|
selectedModuleInstSurfaceArray.push(setupSurface)
|
||||||
|
setCurrentObject({ name: 'moduleSetupSurface', arrayData: [...selectedModuleInstSurfaceArray] })
|
||||||
} else {
|
} else {
|
||||||
//선택후 재선택하면 선택안됨으로 변경
|
//선택후 재선택하면 선택안됨으로 변경
|
||||||
setupSurface.set({
|
setupSurface.set({
|
||||||
@ -295,6 +294,7 @@ export function useModuleBasicSetting(tabNum) {
|
|||||||
const removeIndex = setupSurface.parentId
|
const removeIndex = setupSurface.parentId
|
||||||
const removeArrayIndex = selectedModuleInstSurfaceArray.findIndex((obj) => obj.parentId === removeIndex)
|
const removeArrayIndex = selectedModuleInstSurfaceArray.findIndex((obj) => obj.parentId === removeIndex)
|
||||||
selectedModuleInstSurfaceArray.splice(removeArrayIndex, 1)
|
selectedModuleInstSurfaceArray.splice(removeArrayIndex, 1)
|
||||||
|
setCurrentObject({ name: 'moduleSetupSurface', arrayData: [...selectedModuleInstSurfaceArray] })
|
||||||
}
|
}
|
||||||
|
|
||||||
canvas?.renderAll()
|
canvas?.renderAll()
|
||||||
@ -401,12 +401,11 @@ export function useModuleBasicSetting(tabNum) {
|
|||||||
const moduleHeight = Number(checkedModule[0].shortAxis) / 10
|
const moduleHeight = Number(checkedModule[0].shortAxis) / 10
|
||||||
let tmpWidth = flowDirection === 'south' || flowDirection === 'north' ? moduleWidth : moduleHeight
|
let tmpWidth = flowDirection === 'south' || flowDirection === 'north' ? moduleWidth : moduleHeight
|
||||||
let tmpHeight = flowDirection === 'south' || flowDirection === 'north' ? moduleHeight : moduleWidth
|
let tmpHeight = flowDirection === 'south' || flowDirection === 'north' ? moduleHeight : moduleWidth
|
||||||
let { width, height } = calculateVisibleModuleHeight(
|
|
||||||
tmpWidth,
|
let { width, height } =
|
||||||
tmpHeight,
|
canvasSetting.roofSizeSet === '1'
|
||||||
getDegreeByChon(moduleSetupSurfaces[i].roofMaterial.pitch),
|
? calculateVisibleModuleHeight(tmpWidth, tmpHeight, getDegreeByChon(moduleSetupSurfaces[i].roofMaterial.pitch), flowDirection)
|
||||||
flowDirection,
|
: { width: tmpWidth, height: tmpHeight }
|
||||||
) //각도 적용
|
|
||||||
|
|
||||||
const points = [
|
const points = [
|
||||||
{ x: mousePoint.x - width / 2, y: mousePoint.y - height / 2 },
|
{ x: mousePoint.x - width / 2, y: mousePoint.y - height / 2 },
|
||||||
@ -823,17 +822,16 @@ export function useModuleBasicSetting(tabNum) {
|
|||||||
: Number(module.longAxis)) / 10
|
: Number(module.longAxis)) / 10
|
||||||
}
|
}
|
||||||
|
|
||||||
return calculateVisibleModuleHeight(
|
console.log(canvasSetting)
|
||||||
tmpWidth,
|
|
||||||
tmpHeight,
|
return canvasSetting.roofSizeSet === '1'
|
||||||
getDegreeByChon(moduleSetupSurface.roofMaterial.pitch),
|
? calculateVisibleModuleHeight(tmpWidth, tmpHeight, getDegreeByChon(moduleSetupSurface.roofMaterial.pitch), moduleSetupSurface.flowDirection)
|
||||||
moduleSetupSurface.flowDirection,
|
: { width: tmpWidth, height: tmpHeight }
|
||||||
) //각도 적
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const getFlowLines = (moduleSetupSurface, module) => {
|
const getFlowLines = (moduleSetupSurface, module) => {
|
||||||
let flowLines = {}
|
let flowLines = {}
|
||||||
if (canvasSetting.roofSizeSet !== 3) {
|
if (canvasSetting.roofSizeSet !== '3') {
|
||||||
flowLines = {
|
flowLines = {
|
||||||
bottom: bottomTopFlowLine(moduleSetupSurface, module).find((obj) => obj.target === 'bottom'),
|
bottom: bottomTopFlowLine(moduleSetupSurface, module).find((obj) => obj.target === 'bottom'),
|
||||||
top: bottomTopFlowLine(moduleSetupSurface, module).find((obj) => obj.target === 'top'),
|
top: bottomTopFlowLine(moduleSetupSurface, module).find((obj) => obj.target === 'top'),
|
||||||
|
|||||||
@ -5,10 +5,8 @@ import { useMasterController } from '@/hooks/common/useMasterController'
|
|||||||
import { useCommonCode } from '@/hooks/common/useCommonCode'
|
import { useCommonCode } from '@/hooks/common/useCommonCode'
|
||||||
import { moduleSelectionDataState, moduleSelectionInitParamsState, selectedModuleState } from '@/store/selectedModuleOptions'
|
import { moduleSelectionDataState, moduleSelectionInitParamsState, selectedModuleState } from '@/store/selectedModuleOptions'
|
||||||
import { isObjectNotEmpty, isEqualObjects } from '@/util/common-utils'
|
import { isObjectNotEmpty, isEqualObjects } from '@/util/common-utils'
|
||||||
import { addedRoofsState } from '@/store/settingAtom'
|
|
||||||
|
|
||||||
export function useModuleTabContents({ tabIndex, addRoof, setAddedRoofs, roofTab, tempModuleSelectionData, setTempModuleSelectionData }) {
|
export function useModuleTabContents({ tabIndex, addRoof, setAddedRoofs, roofTab, tempModuleSelectionData, setTempModuleSelectionData }) {
|
||||||
const addRoofsArray = useRecoilValue(addedRoofsState)
|
|
||||||
const globalPitchText = useRecoilValue(pitchTextSelector) //피치 텍스트
|
const globalPitchText = useRecoilValue(pitchTextSelector) //피치 텍스트
|
||||||
|
|
||||||
const { findCommonCode } = useCommonCode()
|
const { findCommonCode } = useCommonCode()
|
||||||
|
|||||||
@ -67,7 +67,7 @@ export function useContextMenu() {
|
|||||||
const commonTextFont = useRecoilValue(fontSelector('commonText'))
|
const commonTextFont = useRecoilValue(fontSelector('commonText'))
|
||||||
const { settingsData, setSettingsDataSave } = useCanvasSetting()
|
const { settingsData, setSettingsDataSave } = useCanvasSetting()
|
||||||
const { swalFire } = useSwal()
|
const { swalFire } = useSwal()
|
||||||
const { alignModule, modulesRemove } = useModule()
|
const { alignModule, modulesRemove, moduleRoofRemove } = useModule()
|
||||||
const { removeRoofMaterial, removeAllRoofMaterial, moveRoofMaterial } = useRoofFn()
|
const { removeRoofMaterial, removeAllRoofMaterial, moveRoofMaterial } = useRoofFn()
|
||||||
|
|
||||||
const currentMenuSetting = () => {
|
const currentMenuSetting = () => {
|
||||||
@ -332,8 +332,8 @@ export function useContextMenu() {
|
|||||||
}, [currentContextMenu])
|
}, [currentContextMenu])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
console.log('currentObject', currentObject)
|
||||||
if (currentObject?.name) {
|
if (currentObject?.name) {
|
||||||
console.log('object', currentObject)
|
|
||||||
switch (currentObject.name) {
|
switch (currentObject.name) {
|
||||||
case 'triangleDormer':
|
case 'triangleDormer':
|
||||||
case 'pentagonDormer':
|
case 'pentagonDormer':
|
||||||
@ -725,21 +725,23 @@ export function useContextMenu() {
|
|||||||
{
|
{
|
||||||
id: 'moduleVerticalCenterAlign',
|
id: 'moduleVerticalCenterAlign',
|
||||||
name: getMessage('contextmenu.module.vertical.align'),
|
name: getMessage('contextmenu.module.vertical.align'),
|
||||||
fn: () => alignModule(MODULE_ALIGN_TYPE.VERTICAL),
|
fn: () => alignModule(MODULE_ALIGN_TYPE.VERTICAL, currentObject.arrayData),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'moduleHorizonCenterAlign',
|
id: 'moduleHorizonCenterAlign',
|
||||||
name: getMessage('contextmenu.module.horizon.align'),
|
name: getMessage('contextmenu.module.horizon.align'),
|
||||||
fn: () => alignModule(MODULE_ALIGN_TYPE.HORIZONTAL),
|
fn: () => alignModule(MODULE_ALIGN_TYPE.HORIZONTAL, currentObject.arrayData),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'moduleRemove',
|
id: 'moduleRemove',
|
||||||
name: getMessage('contextmenu.module.remove'),
|
name: getMessage('contextmenu.module.remove'),
|
||||||
fn: () => {
|
fn: () => {
|
||||||
const moduleSetupSurface = canvas.getObjects().filter((obj) => canvas.getActiveObjects()[0].id === obj.id)[0]
|
moduleRoofRemove(currentObject.arrayData)
|
||||||
const modules = canvas.getObjects().filter((obj) => obj.surfaceId === moduleSetupSurface.id && obj.name === POLYGON_TYPE.MODULE)
|
|
||||||
canvas.remove(...modules)
|
// const moduleSetupSurface = canvas.getObjects().filter((obj) => canvas.getActiveObjects()[0].id === obj.id)[0]
|
||||||
canvas.renderAll()
|
// const modules = canvas.getObjects().filter((obj) => obj.surfaceId === moduleSetupSurface.id && obj.name === POLYGON_TYPE.MODULE)
|
||||||
|
// canvas.remove(...modules)
|
||||||
|
// canvas.renderAll()
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user