Merge pull request 'dev' (#384) from dev into dev-deploy
Reviewed-on: #384
This commit is contained in:
commit
512bdc6b3a
@ -252,6 +252,7 @@ export function useOuterLineWall(id, propertiesId) {
|
|||||||
canvas?.renderAll()
|
canvas?.renderAll()
|
||||||
setOuterLineFix(true)
|
setOuterLineFix(true)
|
||||||
closePopup(id)
|
closePopup(id)
|
||||||
|
ccwCheck()
|
||||||
addPopup(propertiesId, 1, <RoofShapeSetting id={propertiesId} pos={{ x: 50, y: 230 }} />)
|
addPopup(propertiesId, 1, <RoofShapeSetting id={propertiesId} pos={{ x: 50, y: 230 }} />)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -905,6 +906,51 @@ export function useOuterLineWall(id, propertiesId) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 시계방향으로 그려진 경우 반시게방향으로 변경
|
||||||
|
const ccwCheck = () => {
|
||||||
|
let outerLines = canvas.getObjects().filter((obj) => obj.name === 'outerLine')
|
||||||
|
|
||||||
|
if (outerLines.length < 2) {
|
||||||
|
swalFire({ text: getMessage('wall.line.not.found') })
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 외벽선이 시계방향인지 시계반대 방향인지 확인
|
||||||
|
*/
|
||||||
|
const outerLinePoints = outerLines.map((line) => ({ x: line.x1, y: line.y1 }))
|
||||||
|
let counterClockwise = true
|
||||||
|
let signedArea = 0
|
||||||
|
|
||||||
|
outerLinePoints.forEach((point, index) => {
|
||||||
|
const nextPoint = outerLinePoints[(index + 1) % outerLinePoints.length]
|
||||||
|
signedArea += point.x * nextPoint.y - point.y * nextPoint.x
|
||||||
|
})
|
||||||
|
|
||||||
|
if (signedArea > 0) {
|
||||||
|
counterClockwise = false
|
||||||
|
}
|
||||||
|
/** 시계 방향일 경우 외벽선 reverse*/
|
||||||
|
if (!counterClockwise) {
|
||||||
|
outerLines.reverse().forEach((line, index) => {
|
||||||
|
addLine([line.x2, line.y2, line.x1, line.y1], {
|
||||||
|
stroke: line.stroke,
|
||||||
|
strokeWidth: line.strokeWidth,
|
||||||
|
idx: index,
|
||||||
|
selectable: line.selectable,
|
||||||
|
name: 'outerLine',
|
||||||
|
x1: line.x2,
|
||||||
|
y1: line.y2,
|
||||||
|
x2: line.x1,
|
||||||
|
y2: line.y1,
|
||||||
|
visible: line.visible,
|
||||||
|
})
|
||||||
|
canvas.remove(line)
|
||||||
|
})
|
||||||
|
canvas.renderAll()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
points,
|
points,
|
||||||
setPoints,
|
setPoints,
|
||||||
|
|||||||
@ -179,46 +179,6 @@ export function useRoofShapeSetting(id) {
|
|||||||
let outerLines = canvas.getObjects().filter((obj) => obj.name === 'outerLine')
|
let outerLines = canvas.getObjects().filter((obj) => obj.name === 'outerLine')
|
||||||
let direction
|
let direction
|
||||||
|
|
||||||
if (outerLines.length < 2) {
|
|
||||||
swalFire({ text: getMessage('wall.line.not.found') })
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 외벽선이 시계방향인지 시계반대 방향인지 확인
|
|
||||||
*/
|
|
||||||
const outerLinePoints = outerLines.map((line) => ({ x: line.x1, y: line.y1 }))
|
|
||||||
let counterClockwise = true
|
|
||||||
let signedArea = 0
|
|
||||||
|
|
||||||
outerLinePoints.forEach((point, index) => {
|
|
||||||
const nextPoint = outerLinePoints[(index + 1) % outerLinePoints.length]
|
|
||||||
signedArea += point.x * nextPoint.y - point.y * nextPoint.x
|
|
||||||
})
|
|
||||||
|
|
||||||
if (signedArea > 0) {
|
|
||||||
counterClockwise = false
|
|
||||||
}
|
|
||||||
/** 시계 방향일 경우 외벽선 reverse*/
|
|
||||||
if (!counterClockwise) {
|
|
||||||
outerLines.reverse().forEach((line, index) => {
|
|
||||||
addLine([line.x2, line.y2, line.x1, line.y1], {
|
|
||||||
stroke: line.stroke,
|
|
||||||
strokeWidth: line.strokeWidth,
|
|
||||||
idx: index,
|
|
||||||
selectable: line.selectable,
|
|
||||||
name: 'outerLine',
|
|
||||||
x1: line.x2,
|
|
||||||
y1: line.y2,
|
|
||||||
x2: line.x1,
|
|
||||||
y2: line.y1,
|
|
||||||
visible: line.visible,
|
|
||||||
})
|
|
||||||
canvas.remove(line)
|
|
||||||
})
|
|
||||||
canvas.renderAll()
|
|
||||||
}
|
|
||||||
|
|
||||||
if ([1, 2, 3, 5, 6, 7, 8].includes(shapeNum)) {
|
if ([1, 2, 3, 5, 6, 7, 8].includes(shapeNum)) {
|
||||||
// 변별로 설정이 아닌 경우 경사를 지붕재에 적용해주어야함
|
// 변별로 설정이 아닌 경우 경사를 지붕재에 적용해주어야함
|
||||||
setRoofPitch()
|
setRoofPitch()
|
||||||
@ -507,7 +467,7 @@ export function useRoofShapeSetting(id) {
|
|||||||
originX: 'center',
|
originX: 'center',
|
||||||
originY: 'center',
|
originY: 'center',
|
||||||
})
|
})
|
||||||
polygon.setViewLengthText(false)
|
// polygon.setViewLengthText(false)
|
||||||
polygon.lines = [...outerLines]
|
polygon.lines = [...outerLines]
|
||||||
|
|
||||||
addPitchTextsByOuterLines()
|
addPitchTextsByOuterLines()
|
||||||
|
|||||||
@ -1820,7 +1820,13 @@ export function useMode() {
|
|||||||
x: xDiff.eq(0) ? offsetCurrentPoint.x : nextWall.x1,
|
x: xDiff.eq(0) ? offsetCurrentPoint.x : nextWall.x1,
|
||||||
y: yDiff.eq(0) ? offsetCurrentPoint.y : nextWall.y1,
|
y: yDiff.eq(0) ? offsetCurrentPoint.y : nextWall.y1,
|
||||||
}
|
}
|
||||||
const diffOffset = Big(nextWall.attributes.offset).minus(Big(currentWall.attributes.offset))
|
let diffOffset
|
||||||
|
if (nextWall.index > currentWall.index) {
|
||||||
|
diffOffset = Big(nextWall.attributes.offset).minus(Big(currentWall.attributes.offset)).abs()
|
||||||
|
} else {
|
||||||
|
diffOffset = Big(currentWall.attributes.offset).minus(Big(nextWall.attributes.offset))
|
||||||
|
}
|
||||||
|
|
||||||
const offsetPoint2 = {
|
const offsetPoint2 = {
|
||||||
x: yDiff.eq(0) ? offsetPoint1.x : Big(offsetPoint1.x).plus(diffOffset).toNumber(),
|
x: yDiff.eq(0) ? offsetPoint1.x : Big(offsetPoint1.x).plus(diffOffset).toNumber(),
|
||||||
y: xDiff.eq(0) ? offsetPoint1.y : Big(offsetPoint1.y).plus(diffOffset).toNumber(),
|
y: xDiff.eq(0) ? offsetPoint1.y : Big(offsetPoint1.y).plus(diffOffset).toNumber(),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user