Merge pull request '양단 케이블 count 수정' (#151) from dev into prd-deploy

Reviewed-on: #151
This commit is contained in:
ysCha 2025-06-25 14:40:13 +09:00
commit afa8d5d62a

View File

@ -2322,8 +2322,8 @@ export const useTrestle = () => {
if (currentModuleTpCd !== neighborModuleTpCd) {
sizes.push({ width: neighborWidth, height: neighborHeight })
}
/*
m1.set({ fill: m1Fill })
/*m1.set({ fill: m1Fill })
m2.set({ fill: m2Fill })
canvas.renderAll()*/
@ -2349,6 +2349,24 @@ export const useTrestle = () => {
halfMaxX = moduleIntvlHor / 10
halfMaxY = moduleIntvlVer / 10
const leftTopPoint = { x: m1X - width - moduleIntvlHor / 10, y: m1Y - height - moduleIntvlVer / 10 }
const rightTopPoint = { x: m1X + width + moduleIntvlHor / 10, y: m1Y - height - moduleIntvlVer / 10 }
const leftBottomPoint = { x: m1X - width - moduleIntvlHor / 10, y: m1Y + height + moduleIntvlVer / 10 }
const rightBottomPoint = { x: m1X + width + moduleIntvlHor / 10, y: m1Y + height + moduleIntvlVer / 10 }
// {x: m2X, y: m2Y} 가 leftTopPoint, rightTopPoint, leftBottomPoint, rightBottomPoint 내부에 있는지 확인한다.
if (
isPointInRect(
{
x: leftTopPoint.x,
y: leftTopPoint.y,
width: Math.abs(rightTopPoint.x - leftTopPoint.x),
height: Math.abs(leftTopPoint.y - leftBottomPoint.y),
},
{ x: m2X, y: m2Y },
)
) {
return true
}
if (currentModuleTpCd !== neighborModuleTpCd) {
maxX = currentWidth / 2 + neighborWidth / 2 + moduleIntvlHor / 10
maxY = currentHeight / 2 + neighborHeight / 2 + moduleIntvlVer / 10
@ -2373,6 +2391,27 @@ export const useTrestle = () => {
halfMaxX = moduleIntvlVer / 10
halfMaxY = moduleIntvlHor / 10
// 모듈을 기준으로 왼쪽 상, 오른쪽 상, 왼쪽 하, 오른쪽 하의 각 포인트를 계산
const leftTopPoint = { x: m1X - width - moduleIntvlVer / 10, y: m1Y + height + moduleIntvlHor / 10 }
const rightTopPoint = { x: m1X - width - moduleIntvlVer / 10, y: m1Y - height - moduleIntvlHor / 10 }
const leftBottomPoint = { x: m1X + width + moduleIntvlVer / 10, y: m1Y + height + moduleIntvlHor / 10 }
const rightBottomPoint = { x: m1X + width + +moduleIntvlVer / 10, y: m1Y - height - moduleIntvlHor / 10 }
// {x: m2X, y: m2Y} 가 leftTopPoint, rightTopPoint, leftBottomPoint, rightBottomPoint 내부에 있는지 확인한다.
if (
isPointInRect(
{
x: rightTopPoint.x,
y: rightTopPoint.y,
width: Math.abs(rightBottomPoint.x - rightTopPoint.x),
height: Math.abs(leftTopPoint.y - rightTopPoint.y),
},
{ x: m2X, y: m2Y },
)
) {
return true
}
if (currentModuleTpCd !== neighborModuleTpCd) {
maxX = currentHeight / 2 + neighborHeight / 2 + moduleIntvlVer / 10
maxY = currentWidth / 2 + neighborWidth / 2 + moduleIntvlHor / 10
@ -2393,6 +2432,10 @@ export const useTrestle = () => {
})
}
function isPointInRect(rect, point) {
return point.x >= rect.x && point.x <= rect.x + rect.width && point.y >= rect.y && point.y <= rect.y + rect.height
}
// 25-04-02 추가
// 그룹화
function groupPoints(modules, surface) {