dev #170
@ -14,7 +14,7 @@ import {
|
|||||||
} from '@/store/canvasAtom'
|
} from '@/store/canvasAtom'
|
||||||
|
|
||||||
import { rectToPolygon, polygonToTurfPolygon, calculateVisibleModuleHeight, getDegreeByChon, toFixedWithoutRounding } from '@/util/canvas-util'
|
import { rectToPolygon, polygonToTurfPolygon, calculateVisibleModuleHeight, getDegreeByChon, toFixedWithoutRounding } from '@/util/canvas-util'
|
||||||
import { roofDisplaySelector } from '@/store/settingAtom'
|
import { basicSettingState, roofDisplaySelector } from '@/store/settingAtom'
|
||||||
import offsetPolygon, { calculateAngle, createLinesFromPolygon } from '@/util/qpolygon-utils'
|
import offsetPolygon, { calculateAngle, createLinesFromPolygon } from '@/util/qpolygon-utils'
|
||||||
import { QPolygon } from '@/components/fabric/QPolygon'
|
import { QPolygon } from '@/components/fabric/QPolygon'
|
||||||
import { moduleSetupSurfaceState } from '@/store/canvasAtom'
|
import { moduleSetupSurfaceState } from '@/store/canvasAtom'
|
||||||
@ -52,6 +52,7 @@ export function useModuleBasicSetting(tabNum) {
|
|||||||
const [trestleDetailList, setTrestleDetailList] = useState([])
|
const [trestleDetailList, setTrestleDetailList] = useState([])
|
||||||
const selectedModules = useRecoilValue(selectedModuleState)
|
const selectedModules = useRecoilValue(selectedModuleState)
|
||||||
const [saleStoreNorthFlg, setSaleStoreNorthFlg] = useState(false)
|
const [saleStoreNorthFlg, setSaleStoreNorthFlg] = useState(false)
|
||||||
|
const roofSizeSet = useRecoilValue(basicSettingState).roofSizeSet
|
||||||
|
|
||||||
const setCurrentObject = useSetRecoilState(currentObjectState)
|
const setCurrentObject = useSetRecoilState(currentObjectState)
|
||||||
const { setModuleStatisticsData } = useCircuitTrestle()
|
const { setModuleStatisticsData } = useCircuitTrestle()
|
||||||
@ -358,6 +359,7 @@ export function useModuleBasicSetting(tabNum) {
|
|||||||
perPixelTargetFind: true,
|
perPixelTargetFind: true,
|
||||||
isSaleStoreNorthFlg: moduleSelectionData.common.saleStoreNorthFlg == '1' ? true : false, //북면설치가능점 여부
|
isSaleStoreNorthFlg: moduleSelectionData.common.saleStoreNorthFlg == '1' ? true : false, //북면설치가능점 여부
|
||||||
// angle: -compasDeg,
|
// angle: -compasDeg,
|
||||||
|
from: roof.from ?? '',
|
||||||
})
|
})
|
||||||
|
|
||||||
setupSurface.setViewLengthText(false)
|
setupSurface.setViewLengthText(false)
|
||||||
@ -531,6 +533,7 @@ export function useModuleBasicSetting(tabNum) {
|
|||||||
|
|
||||||
for (let i = 0; i < moduleSetupSurfaces.length; i++) {
|
for (let i = 0; i < moduleSetupSurfaces.length; i++) {
|
||||||
//배치면이 여러개 일때 옮겨가면서 동작해야함
|
//배치면이 여러개 일때 옮겨가면서 동작해야함
|
||||||
|
const moduleSetupSurface = moduleSetupSurfaces[i]
|
||||||
turfPolygon = polygonToTurfPolygon(moduleSetupSurfaces[i])
|
turfPolygon = polygonToTurfPolygon(moduleSetupSurfaces[i])
|
||||||
trestlePolygon = moduleSetupSurfaces[i]
|
trestlePolygon = moduleSetupSurfaces[i]
|
||||||
manualDrawModules = moduleSetupSurfaces[i].modules // 앞에서 자동으로 했을때 추가됨
|
manualDrawModules = moduleSetupSurfaces[i].modules // 앞에서 자동으로 했을때 추가됨
|
||||||
@ -542,7 +545,7 @@ export function useModuleBasicSetting(tabNum) {
|
|||||||
let tmpHeight = flowDirection === 'south' || flowDirection === 'north' ? moduleHeight : moduleWidth
|
let tmpHeight = flowDirection === 'south' || flowDirection === 'north' ? moduleHeight : moduleWidth
|
||||||
|
|
||||||
let { width, height } =
|
let { width, height } =
|
||||||
canvasSetting.roofSizeSet == '1'
|
moduleSetupSurface.from === 'roofCover'
|
||||||
? calculateVisibleModuleHeight(tmpWidth, tmpHeight, getDegreeByChon(moduleSetupSurfaces[i].roofMaterial.pitch), flowDirection)
|
? calculateVisibleModuleHeight(tmpWidth, tmpHeight, getDegreeByChon(moduleSetupSurfaces[i].roofMaterial.pitch), flowDirection)
|
||||||
: { width: tmpWidth, height: tmpHeight }
|
: { width: tmpWidth, height: tmpHeight }
|
||||||
|
|
||||||
@ -922,6 +925,7 @@ export function useModuleBasicSetting(tabNum) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//단 열수 지정배치
|
||||||
const manualModuleLayoutSetup = (layoutSetupRef) => {
|
const manualModuleLayoutSetup = (layoutSetupRef) => {
|
||||||
const moduleSetupSurfaces = canvas?.getObjects().filter((obj) => obj.name === POLYGON_TYPE.MODULE_SETUP_SURFACE) //모듈설치면를 가져옴
|
const moduleSetupSurfaces = canvas?.getObjects().filter((obj) => obj.name === POLYGON_TYPE.MODULE_SETUP_SURFACE) //모듈설치면를 가져옴
|
||||||
|
|
||||||
@ -1022,6 +1026,7 @@ export function useModuleBasicSetting(tabNum) {
|
|||||||
|
|
||||||
for (let i = 0; i < moduleSetupSurfaces.length; i++) {
|
for (let i = 0; i < moduleSetupSurfaces.length; i++) {
|
||||||
//배치면이 여러개 일때 옮겨가면서 동작해야함
|
//배치면이 여러개 일때 옮겨가면서 동작해야함
|
||||||
|
const moduleSetupSurface = moduleSetupSurfaces[i]
|
||||||
turfPolygon = polygonToTurfPolygon(moduleSetupSurfaces[i])
|
turfPolygon = polygonToTurfPolygon(moduleSetupSurfaces[i])
|
||||||
trestlePolygon = moduleSetupSurfaces[i]
|
trestlePolygon = moduleSetupSurfaces[i]
|
||||||
manualDrawModules = moduleSetupSurfaces[i].modules // 앞에서 자동으로 했을때 추가됨
|
manualDrawModules = moduleSetupSurfaces[i].modules // 앞에서 자동으로 했을때 추가됨
|
||||||
@ -1035,11 +1040,11 @@ export function useModuleBasicSetting(tabNum) {
|
|||||||
let tmpHeight = flowDirection === 'south' || flowDirection === 'north' ? moduleHeight : moduleWidth
|
let tmpHeight = flowDirection === 'south' || flowDirection === 'north' ? moduleHeight : moduleWidth
|
||||||
|
|
||||||
width =
|
width =
|
||||||
canvasSetting.roofSizeSet == '1'
|
moduleSetupSurface.from === 'roofCover'
|
||||||
? calculateVisibleModuleHeight(tmpWidth, tmpHeight, getDegreeByChon(moduleSetupSurfaces[i].roofMaterial.pitch), flowDirection).width
|
? calculateVisibleModuleHeight(tmpWidth, tmpHeight, getDegreeByChon(moduleSetupSurfaces[i].roofMaterial.pitch), flowDirection).width
|
||||||
: tmpWidth
|
: tmpWidth
|
||||||
height =
|
height =
|
||||||
canvasSetting.roofSizeSet == '1'
|
moduleSetupSurface.from === 'roofCover'
|
||||||
? calculateVisibleModuleHeight(tmpWidth, tmpHeight, getDegreeByChon(moduleSetupSurfaces[i].roofMaterial.pitch), flowDirection).height
|
? calculateVisibleModuleHeight(tmpWidth, tmpHeight, getDegreeByChon(moduleSetupSurfaces[i].roofMaterial.pitch), flowDirection).height
|
||||||
: tmpHeight
|
: tmpHeight
|
||||||
|
|
||||||
@ -1362,11 +1367,11 @@ export function useModuleBasicSetting(tabNum) {
|
|||||||
|
|
||||||
//복시도, 실치수에 따른 모듈 높이 조정
|
//복시도, 실치수에 따른 모듈 높이 조정
|
||||||
width =
|
width =
|
||||||
canvasSetting.roofSizeSet == '1'
|
trestlePolygon.from === 'roofCover'
|
||||||
? calculateVisibleModuleHeight(tmpWidth, tmpHeight, getDegreeByChon(trestlePolygon.roofMaterial.pitch), flowDirection).width
|
? calculateVisibleModuleHeight(tmpWidth, tmpHeight, getDegreeByChon(trestlePolygon.roofMaterial.pitch), flowDirection).width
|
||||||
: tmpWidth
|
: tmpWidth
|
||||||
height =
|
height =
|
||||||
canvasSetting.roofSizeSet == '1'
|
trestlePolygon.from === 'roofCover'
|
||||||
? calculateVisibleModuleHeight(tmpWidth, tmpHeight, getDegreeByChon(trestlePolygon.roofMaterial.pitch), flowDirection).height
|
? calculateVisibleModuleHeight(tmpWidth, tmpHeight, getDegreeByChon(trestlePolygon.roofMaterial.pitch), flowDirection).height
|
||||||
: tmpHeight
|
: tmpHeight
|
||||||
|
|
||||||
@ -3229,6 +3234,7 @@ export function useModuleBasicSetting(tabNum) {
|
|||||||
const mousePoint = canvas.getPointer(e.e)
|
const mousePoint = canvas.getPointer(e.e)
|
||||||
|
|
||||||
for (let i = 0; i < moduleSetupSurfaces.length; i++) {
|
for (let i = 0; i < moduleSetupSurfaces.length; i++) {
|
||||||
|
const moduleSetupSurface = moduleSetupSurfaces[i]
|
||||||
turfPolygon = polygonToTurfPolygon(moduleSetupSurfaces[i], true)
|
turfPolygon = polygonToTurfPolygon(moduleSetupSurfaces[i], true)
|
||||||
trestlePolygon = moduleSetupSurfaces[i]
|
trestlePolygon = moduleSetupSurfaces[i]
|
||||||
manualDrawModules = moduleSetupSurfaces[i].modules // 앞에서 자동으로 했을때 추가됨
|
manualDrawModules = moduleSetupSurfaces[i].modules // 앞에서 자동으로 했을때 추가됨
|
||||||
@ -3241,7 +3247,7 @@ export function useModuleBasicSetting(tabNum) {
|
|||||||
let tmpHeight = flowDirection === 'south' || flowDirection === 'north' ? moduleHeight : moduleWidth
|
let tmpHeight = flowDirection === 'south' || flowDirection === 'north' ? moduleHeight : moduleWidth
|
||||||
|
|
||||||
let { width, height } =
|
let { width, height } =
|
||||||
canvasSetting.roofSizeSet == '1'
|
moduleSetupSurface.from === 'roofCover'
|
||||||
? calculateVisibleModuleHeight(tmpWidth, tmpHeight, getDegreeByChon(moduleSetupSurfaces[i].roofMaterial.pitch), flowDirection)
|
? calculateVisibleModuleHeight(tmpWidth, tmpHeight, getDegreeByChon(moduleSetupSurfaces[i].roofMaterial.pitch), flowDirection)
|
||||||
: { width: tmpWidth, height: tmpHeight }
|
: { width: tmpWidth, height: tmpHeight }
|
||||||
|
|
||||||
@ -3959,7 +3965,7 @@ export function useModuleBasicSetting(tabNum) {
|
|||||||
10
|
10
|
||||||
}
|
}
|
||||||
|
|
||||||
return canvasSetting.roofSizeSet == '1'
|
return moduleSetupSurface.from === 'roofCover'
|
||||||
? calculateVisibleModuleHeight(tmpWidth, tmpHeight, getDegreeByChon(moduleSetupSurface.roofMaterial.pitch), moduleSetupSurface.direction)
|
? calculateVisibleModuleHeight(tmpWidth, tmpHeight, getDegreeByChon(moduleSetupSurface.roofMaterial.pitch), moduleSetupSurface.direction)
|
||||||
: { width: tmpWidth, height: tmpHeight }
|
: { width: tmpWidth, height: tmpHeight }
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1156,12 +1156,12 @@ export const useTrestle = () => {
|
|||||||
case 'south': {
|
case 'south': {
|
||||||
rackInfos.forEach((rackInfo) => {
|
rackInfos.forEach((rackInfo) => {
|
||||||
const { rackLen, itemId, supFitQty, supFitIntvlPct, rackRowsCd, smartRack, smartRackYn } = rackInfo
|
const { rackLen, itemId, supFitQty, supFitIntvlPct, rackRowsCd, smartRack, smartRackYn } = rackInfo
|
||||||
let rackLength = getTrestleLength(rackLen, degree) / 10
|
let rackLength = getTrestleLength(rackLen, degree, surface) / 10
|
||||||
|
|
||||||
if (smartRackYn === 'Y') {
|
if (smartRackYn === 'Y') {
|
||||||
let smartRackId = uuidv4()
|
let smartRackId = uuidv4()
|
||||||
smartRack.forEach(({ seq, setRackTpCd, setRackTpLen, supFitQty }) => {
|
smartRack.forEach(({ seq, setRackTpCd, setRackTpLen, supFitQty }) => {
|
||||||
rackLength = getTrestleLength(setRackTpLen, degree) / 10
|
rackLength = getTrestleLength(setRackTpLen, degree, surface) / 10
|
||||||
if (setRackTpCd === 'RACK') {
|
if (setRackTpCd === 'RACK') {
|
||||||
const rack = new fabric.Line([startPointX, startPointY, startPointX, startPointY - rackLength], {
|
const rack = new fabric.Line([startPointX, startPointY, startPointX, startPointY - rackLength], {
|
||||||
name: TRESTLE_MATERIAL.SMART_RACK,
|
name: TRESTLE_MATERIAL.SMART_RACK,
|
||||||
@ -1230,11 +1230,11 @@ export const useTrestle = () => {
|
|||||||
rackInfos.forEach((rackInfo) => {
|
rackInfos.forEach((rackInfo) => {
|
||||||
const { rackLen, itemId, supFitQty, supFitIntvlPct, rackRowsCd, smartRack, smartRackYn } = rackInfo
|
const { rackLen, itemId, supFitQty, supFitIntvlPct, rackRowsCd, smartRack, smartRackYn } = rackInfo
|
||||||
|
|
||||||
let rackLength = getTrestleLength(rackLen, degree) / 10
|
let rackLength = getTrestleLength(rackLen, degree, surface) / 10
|
||||||
if (smartRackYn === 'Y') {
|
if (smartRackYn === 'Y') {
|
||||||
let smartRackId = uuidv4()
|
let smartRackId = uuidv4()
|
||||||
smartRack.forEach(({ seq, setRackTpCd, setRackTpLen, supFitQty }) => {
|
smartRack.forEach(({ seq, setRackTpCd, setRackTpLen, supFitQty }) => {
|
||||||
rackLength = getTrestleLength(setRackTpLen, degree) / 10
|
rackLength = getTrestleLength(setRackTpLen, degree, surface) / 10
|
||||||
if (setRackTpCd === 'RACK') {
|
if (setRackTpCd === 'RACK') {
|
||||||
const rack = new fabric.Line([startPointX, startPointY, startPointX - rackLength, startPointY], {
|
const rack = new fabric.Line([startPointX, startPointY, startPointX - rackLength, startPointY], {
|
||||||
name: TRESTLE_MATERIAL.SMART_RACK,
|
name: TRESTLE_MATERIAL.SMART_RACK,
|
||||||
@ -1302,11 +1302,11 @@ export const useTrestle = () => {
|
|||||||
case 'west': {
|
case 'west': {
|
||||||
rackInfos.forEach((rackInfo) => {
|
rackInfos.forEach((rackInfo) => {
|
||||||
const { rackLen, itemId, supFitQty, supFitIntvlPct, rackRowsCd, smartRack, smartRackYn } = rackInfo
|
const { rackLen, itemId, supFitQty, supFitIntvlPct, rackRowsCd, smartRack, smartRackYn } = rackInfo
|
||||||
let rackLength = getTrestleLength(rackLen, degree) / 10
|
let rackLength = getTrestleLength(rackLen, degree, surface) / 10
|
||||||
if (smartRackYn === 'Y') {
|
if (smartRackYn === 'Y') {
|
||||||
let smartRackId = uuidv4()
|
let smartRackId = uuidv4()
|
||||||
smartRack.forEach(({ seq, setRackTpCd, setRackTpLen, supFitQty }) => {
|
smartRack.forEach(({ seq, setRackTpCd, setRackTpLen, supFitQty }) => {
|
||||||
rackLength = getTrestleLength(setRackTpLen, degree) / 10
|
rackLength = getTrestleLength(setRackTpLen, degree, surface) / 10
|
||||||
if (setRackTpCd === 'RACK') {
|
if (setRackTpCd === 'RACK') {
|
||||||
const rack = new fabric.Line([startPointX, startPointY, startPointX + rackLength, startPointY], {
|
const rack = new fabric.Line([startPointX, startPointY, startPointX + rackLength, startPointY], {
|
||||||
name: TRESTLE_MATERIAL.SMART_RACK,
|
name: TRESTLE_MATERIAL.SMART_RACK,
|
||||||
@ -1372,11 +1372,11 @@ export const useTrestle = () => {
|
|||||||
case 'north': {
|
case 'north': {
|
||||||
rackInfos.forEach((rackInfo) => {
|
rackInfos.forEach((rackInfo) => {
|
||||||
const { rackLen, itemId, supFitQty, supFitIntvlPct, rackRowsCd, smartRack, smartRackYn } = rackInfo
|
const { rackLen, itemId, supFitQty, supFitIntvlPct, rackRowsCd, smartRack, smartRackYn } = rackInfo
|
||||||
let rackLength = getTrestleLength(rackLen, degree) / 10
|
let rackLength = getTrestleLength(rackLen, degree, surface) / 10
|
||||||
if (smartRackYn === 'Y') {
|
if (smartRackYn === 'Y') {
|
||||||
let smartRackId = uuidv4()
|
let smartRackId = uuidv4()
|
||||||
smartRack.forEach(({ seq, setRackTpCd, setRackTpLen, supFitQty }) => {
|
smartRack.forEach(({ seq, setRackTpCd, setRackTpLen, supFitQty }) => {
|
||||||
rackLength = getTrestleLength(setRackTpLen, degree) / 10
|
rackLength = getTrestleLength(setRackTpLen, degree, surface) / 10
|
||||||
if (setRackTpCd === 'RACK') {
|
if (setRackTpCd === 'RACK') {
|
||||||
const rack = new fabric.Line([startPointX, startPointY, startPointX, startPointY + rackLength], {
|
const rack = new fabric.Line([startPointX, startPointY, startPointX, startPointY + rackLength], {
|
||||||
name: TRESTLE_MATERIAL.SMART_RACK,
|
name: TRESTLE_MATERIAL.SMART_RACK,
|
||||||
@ -2478,9 +2478,9 @@ export const useTrestle = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 각도에 따른 길이 반환
|
// 각도에 따른 길이 반환
|
||||||
function getTrestleLength(length, degree) {
|
function getTrestleLength(length, degree, surface) {
|
||||||
if (roofSizeSet !== 1) {
|
if (surface.from !== 'roofCover') {
|
||||||
// 복시도 입력이 아닌경우 그냥 길이 return
|
// 지붕덮개로부터 온게 아니면 그냥 length 리턴
|
||||||
return length
|
return length
|
||||||
}
|
}
|
||||||
const radians = (degree * Math.PI) / 180
|
const radians = (degree * Math.PI) / 180
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user