1110 : 【HANASYS DESIGN】外周離隔について
모듈 설치영역 offset 수정
This commit is contained in:
parent
aa5cc6aea3
commit
93e3036aff
@ -213,6 +213,7 @@ export const SAVE_KEY = [
|
||||
'editable',
|
||||
'isSortedPoints',
|
||||
'isMultipleOf45',
|
||||
'from',
|
||||
]
|
||||
|
||||
export const OBJECT_PROTOTYPE = [fabric.Line.prototype, fabric.Polygon.prototype, fabric.Triangle.prototype, fabric.Group.prototype]
|
||||
|
||||
@ -133,7 +133,7 @@ export function useModuleBasicSetting(tabNum) {
|
||||
const offsetObjects = moduleSelectionData.roofConstructions.find((item) => item.addRoof.index === roofIndex)
|
||||
|
||||
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)
|
||||
@ -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) {
|
||||
case LINE_TYPE.WALLLINE.EAVES:
|
||||
return data.eavesMargin / 10
|
||||
return eavesResult
|
||||
case LINE_TYPE.WALLLINE.GABLE:
|
||||
return data.kerabaMargin / 10
|
||||
return kerabaMargin
|
||||
case LINE_TYPE.SUBLINE.RIDGE:
|
||||
case LINE_TYPE.WALLLINE.SHED:
|
||||
return data.ridgeMargin / 10
|
||||
return ridgeResult
|
||||
default:
|
||||
return 200 / 10
|
||||
}
|
||||
}
|
||||
|
||||
//선택 배치면 배열`
|
||||
let selectedModuleInstSurfaceArray = []
|
||||
|
||||
|
||||
@ -1158,6 +1158,7 @@ export const usePolygon = () => {
|
||||
originY: 'center',
|
||||
selectable: true,
|
||||
defense: defense,
|
||||
from: 'roofCover',
|
||||
direction: polygonDirection ?? defense,
|
||||
pitch: pitch,
|
||||
})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user