Merge pull request 'dev' (#138) from dev into dev-deploy

Reviewed-on: #138
This commit is contained in:
ysCha 2025-06-23 17:50:40 +09:00
commit 5065999f80
4 changed files with 34 additions and 7 deletions

View File

@ -213,6 +213,7 @@ export const SAVE_KEY = [
'editable', 'editable',
'isSortedPoints', 'isSortedPoints',
'isMultipleOf45', 'isMultipleOf45',
'from',
] ]
export const OBJECT_PROTOTYPE = [fabric.Line.prototype, fabric.Polygon.prototype, fabric.Triangle.prototype, fabric.Group.prototype] export const OBJECT_PROTOTYPE = [fabric.Line.prototype, fabric.Polygon.prototype, fabric.Triangle.prototype, fabric.Group.prototype]

View File

@ -133,7 +133,7 @@ export function useModuleBasicSetting(tabNum) {
const offsetObjects = moduleSelectionData.roofConstructions.find((item) => item.addRoof.index === roofIndex) const offsetObjects = moduleSelectionData.roofConstructions.find((item) => item.addRoof.index === roofIndex)
roof.lines.forEach((line) => { roof.lines.forEach((line) => {
line.attributes = { ...line.attributes, offset: getOffset(offsetObjects.addRoof, line.attributes.type) } line.attributes = { ...line.attributes, offset: getOffset(offsetObjects.addRoof, line.attributes.type, roof.pitch, roof.from) }
}) })
//배치면 설치 영역 //배치면 설치 영역
makeModuleInstArea(roof, detail) makeModuleInstArea(roof, detail)
@ -167,19 +167,45 @@ export function useModuleBasicSetting(tabNum) {
} }
} }
const getOffset = (data, type) => { const getOffset = (data, type, pitch, from = '') => {
const degree = getDegreeByChon(pitch) //각도
// 계산 값
function calculateExpression(thetaDegrees) {
const thetaRadians = (thetaDegrees * Math.PI) / 180 // 각도를 라디안으로 변환
const cosTheta = Math.cos(thetaRadians)
if (cosTheta === 0) {
throw new Error('cos(θ) is zero')
}
const numerator = Math.sqrt(1 + Math.pow(1 / cosTheta, 2))
const denominator = Math.sqrt(2)
return numerator / denominator
}
//경사 신장률은 1 / cos쎄타
const calculateHeightRate = 1 / Math.cos((degree * Math.PI) / 180)
const calculateValue = calculateHeightRate / calculateExpression(degree)
const eavesResult = from === 'roofCover' ? (data.eavesMargin * Math.cos((degree * Math.PI) / 180)) / 10 : data.eavesMargin / 10
const ridgeResult = from === 'roofCover' ? (data.ridgeMargin * Math.cos((degree * Math.PI) / 180)) / 10 : data.ridgeMargin / 10
const kerabaMargin = from === 'roofCover' ? data.kerabaMargin / calculateValue / 10 : data.kerabaMargin / 10
switch (type) { switch (type) {
case LINE_TYPE.WALLLINE.EAVES: case LINE_TYPE.WALLLINE.EAVES:
return data.eavesMargin / 10 return eavesResult
case LINE_TYPE.WALLLINE.GABLE: case LINE_TYPE.WALLLINE.GABLE:
return data.kerabaMargin / 10 return kerabaMargin
case LINE_TYPE.SUBLINE.RIDGE: case LINE_TYPE.SUBLINE.RIDGE:
case LINE_TYPE.WALLLINE.SHED: case LINE_TYPE.WALLLINE.SHED:
return data.ridgeMargin / 10 return ridgeResult
default: default:
return 200 / 10 return 200 / 10
} }
} }
//선택 배치면 배열` //선택 배치면 배열`
let selectedModuleInstSurfaceArray = [] let selectedModuleInstSurfaceArray = []

View File

@ -678,8 +678,7 @@ export function useRoofShapeSetting(id) {
// 벽 // 벽
attributes = { attributes = {
type: LINE_TYPE.WALLLINE.WALL, type: LINE_TYPE.WALLLINE.WALL,
width: hasSleeve === '0' ? 0 : sleeveOffset / 10, offset: hasSleeve === '0' ? 0 : sleeveOffset / 10,
sleeve: hasSleeve === '1',
} }
selectedLine.attributes = { ...attributes, isFixed: true } selectedLine.attributes = { ...attributes, isFixed: true }
break break

View File

@ -1158,6 +1158,7 @@ export const usePolygon = () => {
originY: 'center', originY: 'center',
selectable: true, selectable: true,
defense: defense, defense: defense,
from: 'roofCover',
direction: polygonDirection ?? defense, direction: polygonDirection ?? defense,
pitch: pitch, pitch: pitch,
}) })