배치면의 경우 실제 길이 계산 시 통일 제거, 모듈 설치 시 영역 검사 spare 엄격하게 적용
This commit is contained in:
parent
676af34229
commit
9f0044fe67
@ -8,7 +8,7 @@ export const useTurf = () => {
|
||||
* @param spare
|
||||
* @returns
|
||||
*/
|
||||
const checkModuleDisjointSurface = (module, surface, spare = 1) => {
|
||||
const checkModuleDisjointSurface = (module, surface, spare = 0) => {
|
||||
// 표면 영역을 spare만큼 수동 확장
|
||||
const expandedSurface = {
|
||||
type: 'Polygon',
|
||||
|
||||
@ -2229,7 +2229,7 @@ export function useModuleBasicSetting(tabNum) {
|
||||
//첫번재 모듈 설치 후 두번째 모듈을 몇개까지 설치 할 수 있는지 계산
|
||||
if (installedModuleHeightCount > 0) {
|
||||
// moduleMaxRows = totalModuleMaxRows - installedModuleHeightCount //두번째 모듈일때
|
||||
isChidoriLine = installedModuleHeightCount % 2 != 0 ? true : false //첫번째에서 짝수에서 끝났으면 홀수는 치도리가 아님 짝수는 치도리
|
||||
isChidoriLine = installedModuleHeightCount % 2 !== 0 //첫번째에서 짝수에서 끝났으면 홀수는 치도리가 아님 짝수는 치도리
|
||||
}
|
||||
|
||||
for (let i = 0; i < calcModuleHeightCount; i++) {
|
||||
@ -2249,7 +2249,7 @@ export function useModuleBasicSetting(tabNum) {
|
||||
widthMargin = j === 0 ? 0 : intvHor * j // 가로 마진값
|
||||
chidoriLength = 0 //치도리가 아니여도 기본값을 5정도 준다
|
||||
if (isChidori) {
|
||||
chidoriLength = installedModuleHeightCount % 2 == 0 ? 0 : width / 2 - intvHor
|
||||
chidoriLength = installedModuleHeightCount % 2 === 0 ? 0 : width / 2 - intvHor
|
||||
}
|
||||
|
||||
//치도리 일때 는 짝수(1 기준) 일때만 치도리 라인으로 본다
|
||||
|
||||
@ -241,6 +241,7 @@ export function usePlacementShapeDrawing(id) {
|
||||
originY: 'center',
|
||||
direction: 'south',
|
||||
pitch: globalPitch,
|
||||
from: 'surface',
|
||||
})
|
||||
|
||||
setSurfaceShapePattern(roof, roofDisplay.column)
|
||||
|
||||
@ -1045,6 +1045,7 @@ export function useSurfaceShapeBatch({ isHidden, setIsHidden }) {
|
||||
newPolygon.set({
|
||||
originWidth: width,
|
||||
originHeight: height,
|
||||
from: 'surface',
|
||||
})
|
||||
|
||||
// 캔버스에 추가
|
||||
|
||||
@ -1950,25 +1950,32 @@ export const usePolygon = () => {
|
||||
return
|
||||
}
|
||||
|
||||
// createdRoofs들의 모든 lines를 확인해서 length값이 1이하인 차이가 있으면 통일 시킨다.
|
||||
const allRoofs = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.ROOF)
|
||||
const allRoofLines = allRoofs.flatMap((roof) => roof.lines)
|
||||
for (let i = 0; i < allRoofLines.length; i++) {
|
||||
for (let j = i + 1; j < allRoofLines.length; j++) {
|
||||
const line1 = allRoofLines[i]
|
||||
const line2 = allRoofLines[j]
|
||||
const diff = Math.abs(line1.length - line2.length)
|
||||
if (diff > 0 && diff <= 2) {
|
||||
const maxLength = Math.max(line1.length, line2.length)
|
||||
line1.setLengthByValue(maxLength * 10)
|
||||
line2.setLengthByValue(maxLength * 10)
|
||||
// attributes도 통일
|
||||
const maxPlaneSize = Math.max(line1.attributes.planeSize || 0, line2.attributes.planeSize || 0)
|
||||
const maxActualSize = Math.max(line1.attributes.actualSize || 0, line2.attributes.actualSize || 0)
|
||||
line1.attributes.planeSize = maxPlaneSize
|
||||
line1.attributes.actualSize = maxActualSize
|
||||
line2.attributes.planeSize = maxPlaneSize
|
||||
line2.attributes.actualSize = maxActualSize
|
||||
// 배치면으로 그린 내용은 업데이트를 해준다.
|
||||
if (polygon.from === 'surface') {
|
||||
forceUpdate = true
|
||||
}
|
||||
|
||||
if (polygon.from !== 'surface') {
|
||||
// createdRoofs들의 모든 lines를 확인해서 length값이 1이하인 차이가 있으면 통일 시킨다.
|
||||
const allRoofs = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.ROOF)
|
||||
const allRoofLines = allRoofs.flatMap((roof) => roof.lines)
|
||||
for (let i = 0; i < allRoofLines.length; i++) {
|
||||
for (let j = i + 1; j < allRoofLines.length; j++) {
|
||||
const line1 = allRoofLines[i]
|
||||
const line2 = allRoofLines[j]
|
||||
const diff = Math.abs(line1.length - line2.length)
|
||||
if (diff > 0 && diff <= 2) {
|
||||
const maxLength = Math.max(line1.length, line2.length)
|
||||
line1.setLengthByValue(maxLength * 10)
|
||||
line2.setLengthByValue(maxLength * 10)
|
||||
// attributes도 통일
|
||||
const maxPlaneSize = Math.max(line1.attributes.planeSize || 0, line2.attributes.planeSize || 0)
|
||||
const maxActualSize = Math.max(line1.attributes.actualSize || 0, line2.attributes.actualSize || 0)
|
||||
line1.attributes.planeSize = maxPlaneSize
|
||||
line1.attributes.actualSize = maxActualSize
|
||||
line2.attributes.planeSize = maxPlaneSize
|
||||
line2.attributes.actualSize = maxActualSize
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user