diff --git a/ecosystem.config.js b/ecosystem.config.js new file mode 100644 index 00000000..97676e2e --- /dev/null +++ b/ecosystem.config.js @@ -0,0 +1,10 @@ +module.exports = { + apps: [ + { + name: 'qcast-front-production', + script: 'npm run start', + instance: 2, + exec_mode: 'cluster', + }, + ], +} diff --git a/package.json b/package.json index bf52888e..1f31b9d3 100644 --- a/package.json +++ b/package.json @@ -5,8 +5,9 @@ "scripts": { "dev": "next dev", "build": "next build", - "start": "next start -p 3000", - "start:dev": "next start -p 3001", + "start:cluster1": "next start -p 5000", + "start:cluster2": "next start -p 5001", + "start:dev": "next start -p 5010", "lint": "next lint", "serve": "node server.js" }, diff --git a/src/hooks/module/useModuleBasicSetting.js b/src/hooks/module/useModuleBasicSetting.js index 5db1963e..8ac88a31 100644 --- a/src/hooks/module/useModuleBasicSetting.js +++ b/src/hooks/module/useModuleBasicSetting.js @@ -549,6 +549,7 @@ export function useModuleBasicSetting(tabNum) { * 스냅기능 */ let snapDistance = flowDirection === 'south' || flowDirection === 'north' ? 70 : 40 + let sideSnapDistance = 15 let trestleSnapDistance = 15 let intvHor = @@ -588,51 +589,102 @@ export function useModuleBasicSetting(tabNum) { const holdCellCenterX = holdCellLeft + toFixedWithoutRounding(cell.width / 2, 2) const holdCellCenterY = holdCellTop + toFixedWithoutRounding(cell.height / 2, 2) + //흐름방향따라 달라야 한다. + if (flowDirection === 'south' || flowDirection === 'north') { + if (Math.abs(smallCenterX - holdCellCenterX) < snapDistance) { + //움직이는 모듈 가운데 -> 설치 모듈 가운데 + tempModule.left = holdCellCenterX - toFixedWithoutRounding(width / 2, 2) + } + + //움직이는 모듈왼쪽 -> 가운데 + if (Math.abs(smallLeft - holdCellCenterX) < snapDistance) { + tempModule.left = holdCellCenterX + intvHor / 2 + } + // 오른쪽 -> 가운데 + if (Math.abs(smallRight - holdCellCenterX) < snapDistance) { + tempModule.left = holdCellCenterX - width - intvHor / 2 + } + + //설치된 셀에 좌측에 스냅 + if (Math.abs(smallRight - holdCellLeft) < snapDistance) { + // console.log('모듈 좌측 스냅') + tempModule.left = holdCellLeft - width - intvHor + } + + //설치된 셀에 우측에 스냅 + if (Math.abs(smallLeft - holdCellRight) < snapDistance) { + // console.log('모듈 우측 스냅') + tempModule.left = holdCellRight + intvHor + } + //설치된 셀에 위쪽에 스냅 + if (Math.abs(smallBottom - holdCellTop) < sideSnapDistance) { + tempModule.top = holdCellTop - height - intvVer + } + + //설치된 셀에 밑쪽에 스냅 + if (Math.abs(smallTop - holdCellBottom) < sideSnapDistance) { + tempModule.top = holdCellBottom + intvVer + } + + //설치된 셀에 윗쪽에 스냅 + if (Math.abs(smallTop - holdCellTop) < sideSnapDistance) { + tempModule.top = holdCellTop + } + } else { + //흐름방향 west, east + + //가운데 가운데 + if (Math.abs(smallCenterY - holdCellCenterY) < snapDistance) { + tempModule.top = holdCellCenterY - toFixedWithoutRounding(width / 2, 2) + } + + //위쪽 -> 가운데 + if (Math.abs(smallTop - holdCellCenterY) < snapDistance) { + // console.log('holdCellCenterX', holdCellCenterX) + // console.log('smallLeft', smallLeft) + + // console.log('모듈 센터에 스냅') + tempModule.top = holdCellCenterY + intvHor / 2 + + // console.log('tempModule.left', tempModule.left) + } + // 밑 -> 가운데 + if (Math.abs(smallBottom - holdCellCenterY) < snapDistance) { + tempModule.top = holdCellCenterY - height - intvHor / 2 + } + + //설치된 셀에 좌측에 스냅 + if (Math.abs(smallRight - holdCellLeft) < snapDistance) { + // console.log('모듈 좌측 스냅') + tempModule.left = holdCellLeft - width - intvHor + } + + //설치된 셀에 우측에 스냅 + if (Math.abs(smallLeft - holdCellRight) < snapDistance) { + // console.log('모듈 우측 스냅') + tempModule.left = holdCellRight + intvHor + } + //설치된 셀에 위쪽에 스냅 + if (Math.abs(smallBottom - holdCellTop) < sideSnapDistance) { + tempModule.top = holdCellTop - height - intvVer + } + + //설치된 셀에 밑쪽에 스냅 + if (Math.abs(smallTop - holdCellBottom) < sideSnapDistance) { + tempModule.top = holdCellBottom + intvVer + } + + //설치된 셀에 윗쪽에 스냅 + if (Math.abs(smallTop - holdCellTop) < sideSnapDistance) { + tempModule.top = holdCellTop + } + + if (Math.abs(smallLeft - holdCellLeft) < snapDistance) { + tempModule.left = holdCellLeft + } + } + //가운데 -> 가운대 - if (Math.abs(smallCenterX - holdCellCenterX) < snapDistance) { - tempModule.left = holdCellCenterX - toFixedWithoutRounding(width / 2, 2) - } - - //왼쪽 -> 가운데 - if (Math.abs(smallLeft - holdCellCenterX) < snapDistance) { - // console.log('holdCellCenterX', holdCellCenterX) - // console.log('smallLeft', smallLeft) - - // console.log('모듈 센터에 스냅') - tempModule.left = holdCellCenterX + intvHor / 2 - - // console.log('tempModule.left', tempModule.left) - } - // 오른쪽 -> 가운데 - if (Math.abs(smallRight - holdCellCenterX) < snapDistance) { - tempModule.left = holdCellCenterX - width - intvHor / 2 - } - - //설치된 셀에 좌측에 스냅 - if (Math.abs(smallRight - holdCellLeft) < snapDistance) { - // console.log('모듈 좌측 스냅') - tempModule.left = holdCellLeft - width - intvHor - } - - //설치된 셀에 우측에 스냅 - if (Math.abs(smallLeft - holdCellRight) < snapDistance) { - // console.log('모듈 우측 스냅') - tempModule.left = holdCellRight + intvHor - } - //설치된 셀에 위쪽에 스냅 - if (Math.abs(smallBottom - holdCellTop) < 10) { - tempModule.top = holdCellTop - height - intvVer - } - - //설치된 셀에 밑쪽에 스냅 - if (Math.abs(smallTop - holdCellBottom) < 10) { - tempModule.top = holdCellBottom + intvVer - } - - //설치된 셀에 윗쪽에 스냅 - if (Math.abs(smallTop - holdCellTop) < 10) { - tempModule.top = holdCellTop - } //세로 가운데 -> 가운데 // if (Math.abs(smallCenterY - holdCellCenterY) < snapDistance) { @@ -641,11 +693,6 @@ export function useModuleBasicSetting(tabNum) { // //위쪽 -> 가운데 // if (Math.abs(smallTop - holdCellCenterY) < cellSnapDistance) { // tempModule.top = holdCellCenterY - // } - // //아랫쪽 -> 가운데 - // if (Math.abs(smallBottom - holdCellCenterY) < cellSnapDistance) { - // tempModule.top = holdCellCenterY - height - // } }) } @@ -673,22 +720,19 @@ export function useModuleBasicSetting(tabNum) { // if (Math.abs(smallLeft - (trestleLeft + moduleSetupSurfaces[i].width / 2)) < snapDistance) { // tempModule.left = trestleLeft + moduleSetupSurfaces[i].width / 2 // } - // 모듈이 가운데가 세로중앙선에 붙게 스냅 - if (Math.abs(smallCenterX - (trestleLeft + moduleSetupSurfaces[i].width / 2)) < trestleSnapDistance) { - tempModule.left = trestleLeft + moduleSetupSurfaces[i].width / 2 - tempModule.width / 2 - } - + // if (Math.abs(smallCenterX - (trestleLeft + moduleSetupSurfaces[i].width / 2)) < trestleSnapDistance) { + // tempModule.left = trestleLeft + moduleSetupSurfaces[i].width / 2 - tempModule.width / 2 + // } // 모듈오른쪽이 세로중앙선에 붙게 스냅 // if (Math.abs(smallRight - (trestleLeft + moduleSetupSurfaces[i].width / 2)) < trestleSnapDistance) { // tempModule.left = trestleLeft + moduleSetupSurfaces[i].width / 2 - tempModule.width * tempModule.scaleX // } } else { // 모듈이 가로중앙선에 스냅 - if (Math.abs(smallTop + tempModule.height / 2 - bigCenterY) < trestleSnapDistance) { - tempModule.top = bigCenterY - tempModule.height / 2 - } - + // if (Math.abs(smallTop + tempModule.height / 2 - bigCenterY) < trestleSnapDistance) { + // tempModule.top = bigCenterY - tempModule.height / 2 + // } // if (Math.abs(smallTop - (trestleTop + moduleSetupSurfaces[i].height / 2)) < trestleSnapDistance) { // tempModule.top = trestleTop + moduleSetupSurfaces[i].height / 2 // } diff --git a/src/hooks/usePolygon.js b/src/hooks/usePolygon.js index 54de877b..fd5b5a69 100644 --- a/src/hooks/usePolygon.js +++ b/src/hooks/usePolygon.js @@ -767,7 +767,7 @@ export const usePolygon = () => { obj.type === 'QLine' && obj.attributes?.type !== 'pitchSizeLine' && obj.attributes?.roofId === polygon.id && - (innerLineTypes.includes(obj.name) || !obj.name), + innerLineTypes.includes(obj.name), ) innerLines = [...polygon.innerLines] diff --git a/src/locales/ja.json b/src/locales/ja.json index 0028a047..d6670702 100644 --- a/src/locales/ja.json +++ b/src/locales/ja.json @@ -558,7 +558,7 @@ "board.faq.title": "FAQ", "board.faq.sub.title": "FAQリスト", "board.archive.title": "各種資料ダウンロード", - "board.archive.sub.title": "見積書一覧", + "board.archive.sub.title": "掲載資料一覧", "board.list.header.rownum": "番号", "board.list.header.title": "タイトル", "board.list.header.regDt": "登録日", diff --git a/src/util/canvas-util.js b/src/util/canvas-util.js index 935097b0..1146afa7 100644 --- a/src/util/canvas-util.js +++ b/src/util/canvas-util.js @@ -518,14 +518,23 @@ export const sortedPointLessEightPoint = (points) => { */ // 직선의 방정식. // 방정식은 ax + by + c = 0이며, 점의 좌표를 대입하여 계산된 값은 직선과 점 사이의 관계를 나타낸다. -export function isPointOnLine(line, point) { - const a = line.y2 - line.y1 +export function isPointOnLine({ x1, y1, x2, y2 }, { x, y }) { + /*const a = line.y2 - line.y1 const b = line.x1 - line.x2 const c = line.x2 * line.y1 - line.x1 * line.y2 const result = Math.abs(a * point.x + b * point.y + c) / 100 // 점이 선 위에 있는지 확인 - return result <= 10 + return result <= 10*/ + // 직선 방정식 만족 여부 확인 + const crossProduct = (y - y1) * (x2 - x1) - (x - x1) * (y2 - y1) + if (Math.abs(crossProduct) > 5) return false // 작은 오차 허용 + + // 점이 선분의 범위 내에 있는지 확인 + const withinXRange = Math.min(x1, x2) <= x && x <= Math.max(x1, x2) + const withinYRange = Math.min(y1, y2) <= y && y <= Math.max(y1, y2) + + return withinXRange && withinYRange } /** * 점과 가까운 line 찾기