모듈 높이 계산 삭제

This commit is contained in:
yjnoh 2025-02-25 09:37:47 +09:00
parent 4998dbc6d3
commit e559cce7bc
2 changed files with 39 additions and 34 deletions

View File

@ -911,7 +911,7 @@ export function useModuleBasicSetting(tabNum) {
let moduleMaxRows = tmpModuleData.mixModuleMaxRows === 0 ? tmpModuleData.moduleMaxRows : tmpModuleData.mixModuleMaxRows
// 혼합모듈 포함 총 모듈 설치 높이 갯수
const totalModuleMaxRows = tmpModuleData.moduleMaxRows
// const totalModuleMaxRows = tmpModuleData.moduleMaxRows
//모듈의 넓이 높이를 가져옴 (복시도 촌수 적용)
//1번 깔았던 모듈 기준으로 잡야아함
@ -962,12 +962,13 @@ export function useModuleBasicSetting(tabNum) {
let calcAreaWidth = flowLines.right.x1 - flowLines.left.x1 //오른쪽 x에서 왼쪽 x를 뺀 가운데를 찾는 로직
let calcModuleWidthCount = calcAreaWidth / (width + intvHor) //뺀 공간에서 모듈을 몇개를 넣을수 있는지 확인하는 로직
let calcMaxModuleWidthCount = calcModuleWidthCount > moduleMaxCols ? moduleMaxCols : calcModuleWidthCount //최대 모듈 단수가 있기 때문에 최대 단수보다 카운트가 크면 최대 단수로 씀씀
// let totalModuleWidthCount = isChidori ? Math.abs(calcMaxModuleWidthCount) : Math.floor(calcMaxModuleWidthCount) //치조배치일경우는 한개 더 넣는다
let totalModuleWidthCount = Math.floor(calcMaxModuleWidthCount) //치조배치일경우는 한개 더 넣는다
// let calcAreaHeight = flowLines.bottom.y1 - flowLines.top.y1
// let calcModuleHeightCount = calcAreaHeight / (height + intvVer)
let calcAreaHeight = flowLines.bottom.y1 - flowLines.top.y1
let calcModuleHeightCount = calcAreaHeight / (height + intvVer)
let calcStartPoint = flowLines.right.type === 'flat' ? (calcAreaWidth - totalModuleWidthCount * width) / 2 : 0 //반씩 나눠서 중앙에 맞춤 bottom 기준으로 양변이 직선일때만 가운데 정렬
let startPointX = flowLines.left.x1 + calcStartPoint //시작점을 만든다
@ -976,9 +977,9 @@ export function useModuleBasicSetting(tabNum) {
if (flowLines.left.type === 'curve' && flowLines.right.type === 'curve') {
startPointX = flowLines.left.x1 + (calcAreaWidth - totalModuleWidthCount * width) / 2
if (flowLines.left.x1 < flowLines.bottom.x1) {
startPointX = flowLines.left.x1
}
// if (flowLines.left.x1 < flowLines.bottom.x1) {
// startPointX = flowLines.left.x1
// }
}
let heightMargin = 0
@ -987,13 +988,13 @@ export function useModuleBasicSetting(tabNum) {
//첫번재 모듈 설치 후 두번째 모듈을 몇개까지 설치 할 수 있는지 계산
if (moduleIndex > 0) {
moduleMaxRows = totalModuleMaxRows - installedModuleHeightCount //두번째 모듈일때
// moduleMaxRows = totalModuleMaxRows - installedModuleHeightCount //두번째 모듈일때
isChidoriLine = installedModuleHeightCount % 2 != 0 ? true : false //첫번째에서 짝수에서 끝났으면 홀수는 치도리가 아님 짝수는 치도리
}
let isInstall = false
for (let i = 0; i < moduleMaxRows; i++) {
for (let i = 0; i < calcModuleHeightCount; i++) {
let moduleY = flowLines.bottom.y1 - height * i - 1 //살짝 여유를 준다
//두번째 모듈 -> 혼합일 경우의 설치될 모듈 높이를 계산
@ -1002,9 +1003,10 @@ export function useModuleBasicSetting(tabNum) {
}
//전체 설치 간으 모듈이랑 같으면 반복을 멈춘다
if (totalModuleMaxRows === installedModuleHeightCount) {
break
}
//사용안함 전체를 위로 올리기로 했음
// if (totalModuleMaxRows === installedModuleHeightCount) {
// break
// }
//첫번째는 붙여서 두번째는 마진을 주고 설치
heightMargin = i === 0 ? 0 : intvVer * i
@ -1233,6 +1235,9 @@ export function useModuleBasicSetting(tabNum) {
// let totalModuleWidthCount = isChidori ? Math.abs(calcMaxModuleWidthCount) : Math.floor(calcMaxModuleWidthCount) //치조배치일경우는 한개 더 넣는다 //??어쩔때는 붙고 어쩔때는 안붙고 멋대로???
let totalModuleWidthCount = Math.floor(calcMaxModuleWidthCount) //치조배치일경우는 한개 더 넣는다
let calcAreaHeight = flowLines.bottom.y1 - flowLines.top.y1
let calcModuleHeightCount = calcAreaHeight / (height + intvVer)
let calcStartPoint = flowLines.left.type === 'flat' ? (calcAreaWidth - totalModuleWidthCount * width) / 2 : 0 //반씩 나눠서 중앙에 맞춤 bottom 기준으로 양변이 직선일때만 가운데 정렬
let startPointX = flowLines.right.x1 - calcStartPoint //시작점을 만든다
@ -1257,7 +1262,7 @@ export function useModuleBasicSetting(tabNum) {
let isInstall = false
for (let i = 0; i < moduleMaxRows; i++) {
for (let i = 0; i < calcModuleHeightCount; i++) {
let moduleY = flowLines.top.y1 + height * i //탑의 y점에서부터 아래로 그려 내려간다
if (moduleIndex > 0) {
@ -1265,9 +1270,9 @@ export function useModuleBasicSetting(tabNum) {
}
//전체 설치 간으 모듈이랑 같으면 반복을 멈춘다
if (totalModuleMaxRows === installedModuleHeightCount) {
break
}
// if (totalModuleMaxRows === installedModuleHeightCount) {
// break
// }
heightMargin = i === 0 ? 0 : intvVer * i //모듈간에 마진이 있어 마진값도 넣음
for (let j = 0; j < totalModuleWidthCount; j++) {
@ -1328,9 +1333,9 @@ export function useModuleBasicSetting(tabNum) {
installedLastHeightCoord = moduleY + height + heightMargin
} else {
//디버깅용
// tempModule.set({ fill: 'transparent', stroke: 'red', strokeWidth: 1 })
// canvas?.add(tempModule)
// canvas.renderAll()
tempModule.set({ fill: 'transparent', stroke: 'red', strokeWidth: 1 })
canvas?.add(tempModule)
canvas.renderAll()
}
}
if (isInstall) {
@ -1533,8 +1538,8 @@ export function useModuleBasicSetting(tabNum) {
// let totalModuleWidthCount = isChidori ? Math.abs(calcMaxModuleWidthCount) : Math.floor(calcMaxModuleWidthCount) //치조배치일경우는 한개 더 넣는다
let totalModuleWidthCount = Math.floor(calcMaxModuleWidthCount) //치조배치일경우는 한개 더 넣는다
// let calcAreaHeight = flowLines.bottom.y1 - flowLines.top.y1
// let calcModuleHeightCount = calcAreaHeight / (height + intvVer)
let calcAreaHeight = flowLines.right.x1 - flowLines.left.x1
let calcModuleHeightCount = calcAreaHeight / (width + intvVer)
let calcStartPoint = flowLines.bottom.type === 'flat' ? (calcAreaWidth - totalModuleWidthCount * height) / 2 : 0 //반씩 나눠서 중앙에 맞춤 left 높이 기준으로 양변이 직선일때만 가운데 정렬
let startPointX = flowLines.top.y1 + calcStartPoint //시작점을 만든다
@ -1561,7 +1566,7 @@ export function useModuleBasicSetting(tabNum) {
let isInstall = false
for (let i = 0; i < moduleMaxRows; i++) {
for (let i = 0; i < calcModuleHeightCount; i++) {
let moduleY = flowLines.left.x1 + width * i + 1 //살짝 여유를 준다
//두번째 모듈 -> 혼합일 경우의 설치될 모듈 높이를 계산
@ -1570,9 +1575,9 @@ export function useModuleBasicSetting(tabNum) {
}
//전체 설치 간으 모듈이랑 같으면 반복을 멈춘다
if (totalModuleMaxRows === installedModuleHeightCount) {
break
}
// if (totalModuleMaxRows === installedModuleHeightCount) {
// break
// }
//첫번째는 붙여서 두번째는 마진을 주고 설치
heightMargin = i === 0 ? 0 : intvHor * i
@ -1638,9 +1643,9 @@ export function useModuleBasicSetting(tabNum) {
// }
} else {
//디버깅용
// tempModule.set({ fill: 'transparent', stroke: 'red', strokeWidth: 1 })
// canvas?.add(tempModule)
// canvas.renderAll()
tempModule.set({ fill: 'transparent', stroke: 'red', strokeWidth: 1 })
canvas?.add(tempModule)
canvas.renderAll()
}
}
@ -1835,8 +1840,8 @@ export function useModuleBasicSetting(tabNum) {
// let totalModuleWidthCount = isChidori ? Math.abs(calcMaxModuleWidthCount) : Math.floor(calcMaxModuleWidthCount) //치조배치일경우는 한개 더 넣는다
let totalModuleWidthCount = Math.floor(calcMaxModuleWidthCount) //치조배치일경우는 한개 더 넣는다
// let calcAreaHeight = flowLines.bottom.y1 - flowLines.top.y1
// let calcModuleHeightCount = calcAreaHeight / (height + intvVer)
let calcAreaHeight = flowLines.right.x1 - flowLines.left.x1
let calcModuleHeightCount = calcAreaHeight / (width + intvVer)
let calcStartPoint = flowLines.top.type === 'flat' ? (calcAreaWidth - totalModuleWidthCount * height) / 2 : 0 //반씩 나눠서 중앙에 맞춤 left 높이 기준으로 양변이 직선일때만 가운데 정렬
let startPointX = flowLines.bottom.y2 - calcStartPoint //시작점을 만든다
@ -1863,7 +1868,7 @@ export function useModuleBasicSetting(tabNum) {
let isInstall = false
for (let i = 0; i < moduleMaxRows; i++) {
for (let i = 0; i < calcModuleHeightCount; i++) {
let moduleY = flowLines.right.x1 - width * i - 1 //살짝 여유를 준다
//두번째 모듈 -> 혼합일 경우의 설치될 모듈 높이를 계산
@ -1872,9 +1877,9 @@ export function useModuleBasicSetting(tabNum) {
}
//전체 설치 간으 모듈이랑 같으면 반복을 멈춘다
if (totalModuleMaxRows === installedModuleHeightCount) {
break
}
// if (totalModuleMaxRows === installedModuleHeightCount) {
// break
// }
//첫번째는 붙여서 두번째는 마진을 주고 설치
heightMargin = i === 0 ? 0 : intvHor * i

View File

@ -140,7 +140,7 @@ export function useSurfaceShapeBatch({ isHidden, setIsHidden }) {
}
}
} else {
imageRotate = (rotate + 4) % 4
imageRotate = (rotate + 360) % 360
}
obj.set({ angle: imageRotate })
obj.setCoords() //좌표 변경 적용