상면 오류 수정

This commit is contained in:
hyojun.choi 2024-11-21 10:33:14 +09:00
parent e0938c9db8
commit edc7a24553

View File

@ -640,7 +640,7 @@ export function useModuleBasicSetting() {
module.tempIndex = index module.tempIndex = index
const { x, y } = module.getCenterPoint() const { x, y } = module.getCenterPoint()
const { width, height } = module const { width, height } = module
centerPoints.push({ x, y, width, height }) centerPoints.push({ x, y, width, height, index })
const circle = new fabric.Circle({ const circle = new fabric.Circle({
radius: 5, radius: 5,
fill: 'red', fill: 'red',
@ -665,7 +665,6 @@ export function useModuleBasicSetting() {
let touchDimension = 0 let touchDimension = 0
//반접면 //반접면
let halfTouchDimension = 0 let halfTouchDimension = 0
// 노출하면 체크 // 노출하면 체크
centerPoints.forEach((centerPoint, index) => { centerPoints.forEach((centerPoint, index) => {
const { x, y, width, height } = centerPoint const { x, y, width, height } = centerPoint
@ -676,12 +675,15 @@ export function useModuleBasicSetting() {
return return
} }
const bottomLeftPoint = { x: x - width / 2, y: y + height }
const bottomRightPoint = { x: x + width / 2, y: y + height }
// 바로 아래에 셀이 없는 경우 물떼세 배치가 왼쪽 되어있는 셀을 찾는다. // 바로 아래에 셀이 없는 경우 물떼세 배치가 왼쪽 되어있는 셀을 찾는다.
const leftBottomCnt = centerPoints.filter( const leftBottomCnt = centerPoints.filter(
(centerPoint) => Math.abs(centerPoint.x - (x - width / 2)) < 2 && Math.abs(centerPoint.y - (y + height)) < 2, (centerPoint) => Math.abs(centerPoint.x - bottomLeftPoint.x) < 2 && Math.abs(centerPoint.y - bottomLeftPoint.y) < 2,
).length ).length
const rightBottomCnt = centerPoints.filter( const rightBottomCnt = centerPoints.filter(
(centerPoint) => Math.abs(centerPoint.x - (x + width / 2)) < 2 && Math.abs(centerPoint.y - (y + height)) < 2, (centerPoint) => Math.abs(centerPoint.x - bottomRightPoint.x) < 2 && Math.abs(centerPoint.y - bottomRightPoint.y) < 2,
).length ).length
if (leftBottomCnt + rightBottomCnt === 2) { if (leftBottomCnt + rightBottomCnt === 2) {
touchDimension++ touchDimension++
@ -706,11 +708,14 @@ export function useModuleBasicSetting() {
return return
} }
const topLeftPoint = { x: x - width / 2, y: y - height }
const topRightPoint = { x: x + width / 2, y: y - height }
const leftTopCnt = centerPoints.filter( const leftTopCnt = centerPoints.filter(
(centerPoint) => Math.abs(centerPoint.x - (x - width) < 2) && Math.abs(centerPoint.y - (y - height)) < 2, (centerPoint) => Math.abs(centerPoint.x - topLeftPoint.x) < 2 && Math.abs(centerPoint.y - topRightPoint.y) < 2,
).length ).length
const rightTopCnt = centerPoints.filter( const rightTopCnt = centerPoints.filter(
(centerPoint) => Math.abs(centerPoint.x - (x + width / 2) < 2) && Math.abs(centerPoint.y - (y - height)) < 2, (centerPoint) => Math.abs(centerPoint.x - topRightPoint.x) < 2 && Math.abs(centerPoint.y - topRightPoint.y) < 2,
).length ).length
if (leftTopCnt + rightTopCnt === 1) { if (leftTopCnt + rightTopCnt === 1) {