가대 설치 계산 수정
This commit is contained in:
parent
6105d3a1bf
commit
d60a38594c
@ -1730,7 +1730,7 @@ export const useTrestle = () => {
|
||||
const { width, height } = { ...module }
|
||||
widthArr.push(width)
|
||||
heightArr.push(height)
|
||||
centerPoints.push({ x, y, width: Math.floor(width), height: Math.floor(height), index, moduleInfo: module.moduleInfo })
|
||||
centerPoints.push({ x, y, width: Math.floor(width), height: Math.floor(height), index, moduleInfo: module.moduleInfo, module })
|
||||
})
|
||||
|
||||
//widthArr 중복 제거 1이상 차이가 나지 않으면 같은 너비로 간주
|
||||
@ -1804,7 +1804,13 @@ export const useTrestle = () => {
|
||||
let rightExposedHalfTopPoints = []
|
||||
|
||||
centerPoints.forEach((centerPoint, index) => {
|
||||
let { x, y, width, height, widthArr, heightArr } = { ...centerPoint }
|
||||
let { x, y, width, height, widthArr, heightArr, module } = { ...centerPoint }
|
||||
|
||||
/* 디버깅용
|
||||
const originFill = module.fill
|
||||
module.set('fill', 'red')
|
||||
canvas.renderAll()*/
|
||||
|
||||
// centerPoints중에 현재 centerPoint와 x값이 같고, y값이 y-height값과 같은 centerPoint가 있는지 확인
|
||||
let bottomCell
|
||||
let bottomLeftPoint
|
||||
@ -1894,7 +1900,12 @@ export const useTrestle = () => {
|
||||
|
||||
break
|
||||
}
|
||||
/**
|
||||
* 디버깅용
|
||||
|
||||
module.set('fill', originFill)
|
||||
canvas.renderAll()
|
||||
*/
|
||||
if (bottomCell) {
|
||||
return
|
||||
}
|
||||
@ -1911,13 +1922,18 @@ export const useTrestle = () => {
|
||||
}
|
||||
} else if (leftBottomCnt + rightBottomCnt === 0) {
|
||||
exposedBottomPoints.push(centerPoint)
|
||||
} else if (leftBottomCnt + rightBottomCnt === 2) {
|
||||
touchDimension++
|
||||
}
|
||||
})
|
||||
// 노출상면 및 접면 체크
|
||||
|
||||
centerPoints.forEach((centerPoint, index) => {
|
||||
let { x, y, width, height, widthArr, heightArr } = { ...centerPoint }
|
||||
|
||||
let { x, y, width, height, widthArr, heightArr, module } = { ...centerPoint }
|
||||
const originFill = module.fill
|
||||
/* 디버깅용
|
||||
module.set('fill', 'blue')
|
||||
canvas.renderAll()*/
|
||||
let topCell
|
||||
let topLeftPoint
|
||||
let topRightPoint
|
||||
@ -1930,7 +1946,8 @@ export const useTrestle = () => {
|
||||
height = height + vertical
|
||||
heightArr.forEach((h) => {
|
||||
if (topCell) return
|
||||
topCell = centerPoints.find((centerPoint) => Math.abs(centerPoint.x - x) < maxX && Math.abs(centerPoint.y - (y + h)) < maxY)
|
||||
topCell = centerPoints.find((centerPoint) => Math.abs(centerPoint.x - x) < maxX && Math.abs(centerPoint.y - (y - h)) < maxY)
|
||||
|
||||
if (leftTopCnt === 0) {
|
||||
topLeftPoint = { x: x - width / 2, y: y - h }
|
||||
leftTopCnt = centerPoints.filter(
|
||||
@ -1949,7 +1966,7 @@ export const useTrestle = () => {
|
||||
height = height + vertical
|
||||
heightArr.forEach((h) => {
|
||||
if (topCell) return
|
||||
topCell = centerPoints.find((centerPoint) => Math.abs(centerPoint.x - x) < maxX && Math.abs(centerPoint.y - (y - h)) < maxY)
|
||||
topCell = centerPoints.find((centerPoint) => Math.abs(centerPoint.x - x) < maxX && Math.abs(centerPoint.y - (y + h)) < maxY)
|
||||
if (leftTopCnt === 0) {
|
||||
topLeftPoint = { x: x + width / 2, y: y + h }
|
||||
leftTopCnt = centerPoints.filter(
|
||||
@ -1968,7 +1985,7 @@ export const useTrestle = () => {
|
||||
width = width + horizontal
|
||||
widthArr.forEach((w) => {
|
||||
if (topCell) return
|
||||
topCell = centerPoints.find((centerPoint) => Math.abs(centerPoint.x - (x + w)) < maxX && Math.abs(centerPoint.y - y) < maxY)
|
||||
topCell = centerPoints.find((centerPoint) => Math.abs(centerPoint.x - (x - w)) < maxX && Math.abs(centerPoint.y - y) < maxY)
|
||||
if (leftTopCnt === 0) {
|
||||
topLeftPoint = { x: x - w, y: y + height / 2 }
|
||||
leftTopCnt = centerPoints.filter(
|
||||
@ -1988,7 +2005,7 @@ export const useTrestle = () => {
|
||||
width = width + horizontal
|
||||
widthArr.forEach((w) => {
|
||||
if (topCell) return
|
||||
topCell = centerPoints.find((centerPoint) => Math.abs(centerPoint.x - (x - w)) < maxX && Math.abs(centerPoint.y - y) < maxY)
|
||||
topCell = centerPoints.find((centerPoint) => Math.abs(centerPoint.x - (x + w)) < maxX && Math.abs(centerPoint.y - y) < maxY)
|
||||
if (leftTopCnt === 0) {
|
||||
topLeftPoint = { x: x + w, y: y - height / 2 }
|
||||
leftTopCnt = centerPoints.filter(
|
||||
@ -2010,6 +2027,13 @@ export const useTrestle = () => {
|
||||
return
|
||||
}
|
||||
|
||||
/**
|
||||
* 디버깅 용
|
||||
|
||||
module.set('fill', originFill)
|
||||
canvas.renderAll()
|
||||
*/
|
||||
|
||||
if (leftTopCnt + rightTopCnt === 2) {
|
||||
touchDimension++
|
||||
return
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user