지붕할당 후 흐름방향 표시 위치 수정 요청

This commit is contained in:
hyojun.choi 2025-02-03 18:11:14 +09:00
parent b10c91909a
commit d4241c3c16

View File

@ -192,6 +192,7 @@ export const usePolygon = () => {
}
let centerPoint = { x: polygon.left, y: polygon.top }
const { width, height } = polygon
let stickeyPoint
const polygonMaxX = Math.max(...polygon.getCurrentPoints().map((point) => point.x))
@ -202,58 +203,58 @@ export const usePolygon = () => {
switch (direction) {
case 'north':
points = [
{ x: centerPoint.x, y: polygonMinY - 50 },
{ x: centerPoint.x + 20, y: polygonMinY - 50 },
{ x: centerPoint.x + 20, y: polygonMinY - 80 },
{ x: centerPoint.x + 50, y: polygonMinY - 80 },
{ x: centerPoint.x, y: polygonMinY - 110 },
{ x: centerPoint.x - 50, y: polygonMinY - 80 },
{ x: centerPoint.x - 20, y: polygonMinY - 80 },
{ x: centerPoint.x - 20, y: polygonMinY - 50 },
{ x: centerPoint.x - width / 2, y: polygonMinY - 50 },
{ x: centerPoint.x + 20 - width / 2, y: polygonMinY - 50 },
{ x: centerPoint.x + 20 - width / 2, y: polygonMinY - 80 },
{ x: centerPoint.x + 50 - width / 2, y: polygonMinY - 80 },
{ x: centerPoint.x - width / 2, y: polygonMinY - 110 },
{ x: centerPoint.x - 50 - width / 2, y: polygonMinY - 80 },
{ x: centerPoint.x - 20 - width / 2, y: polygonMinY - 80 },
{ x: centerPoint.x - 20 - width / 2, y: polygonMinY - 50 },
]
stickeyPoint = { x: centerPoint.x, y: polygonMinY - 110 }
stickeyPoint = { x: centerPoint.x - width / 2, y: polygonMinY - 110 }
break
case 'south':
points = [
{ x: centerPoint.x, y: polygonMaxY + 50 },
{ x: centerPoint.x + 20, y: polygonMaxY + 50 },
{ x: centerPoint.x + 20, y: polygonMaxY + 80 },
{ x: centerPoint.x + 50, y: polygonMaxY + 80 },
{ x: centerPoint.x, y: polygonMaxY + 110 },
{ x: centerPoint.x - 50, y: polygonMaxY + 80 },
{ x: centerPoint.x - 20, y: polygonMaxY + 80 },
{ x: centerPoint.x - 20, y: polygonMaxY + 50 },
{ x: centerPoint.x + width / 2, y: polygonMaxY + 50 },
{ x: centerPoint.x + 20 + width / 2, y: polygonMaxY + 50 },
{ x: centerPoint.x + 20 + width / 2, y: polygonMaxY + 80 },
{ x: centerPoint.x + 50 + width / 2, y: polygonMaxY + 80 },
{ x: centerPoint.x + width / 2, y: polygonMaxY + 110 },
{ x: centerPoint.x - 50 + width / 2, y: polygonMaxY + 80 },
{ x: centerPoint.x - 20 + width / 2, y: polygonMaxY + 80 },
{ x: centerPoint.x - 20 + width / 2, y: polygonMaxY + 50 },
]
stickeyPoint = { x: centerPoint.x, y: polygonMaxY + 110 }
stickeyPoint = { x: centerPoint.x + width / 2, y: polygonMaxY + 110 }
break
case 'west':
points = [
{ x: polygonMinX - 50, y: centerPoint.y },
{ x: polygonMinX - 50, y: centerPoint.y + 20 },
{ x: polygonMinX - 80, y: centerPoint.y + 20 },
{ x: polygonMinX - 80, y: centerPoint.y + 50 },
{ x: polygonMinX - 110, y: centerPoint.y },
{ x: polygonMinX - 80, y: centerPoint.y - 50 },
{ x: polygonMinX - 80, y: centerPoint.y - 20 },
{ x: polygonMinX - 50, y: centerPoint.y - 20 },
{ x: polygonMinX - 50, y: centerPoint.y - height / 2 },
{ x: polygonMinX - 50, y: centerPoint.y + 20 - height / 2 },
{ x: polygonMinX - 80, y: centerPoint.y + 20 - height / 2 },
{ x: polygonMinX - 80, y: centerPoint.y + 50 - height / 2 },
{ x: polygonMinX - 110, y: centerPoint.y - height / 2 },
{ x: polygonMinX - 80, y: centerPoint.y - 50 - height / 2 },
{ x: polygonMinX - 80, y: centerPoint.y - 20 - height / 2 },
{ x: polygonMinX - 50, y: centerPoint.y - 20 - height / 2 },
]
stickeyPoint = { x: polygonMinX - 110, y: centerPoint.y }
stickeyPoint = { x: polygonMinX - 110, y: centerPoint.y - height / 2 }
break
case 'east':
points = [
{ x: polygonMaxX + 50, y: centerPoint.y },
{ x: polygonMaxX + 50, y: centerPoint.y + 20 },
{ x: polygonMaxX + 80, y: centerPoint.y + 20 },
{ x: polygonMaxX + 80, y: centerPoint.y + 50 },
{ x: polygonMaxX + 110, y: centerPoint.y },
{ x: polygonMaxX + 80, y: centerPoint.y - 50 },
{ x: polygonMaxX + 80, y: centerPoint.y - 20 },
{ x: polygonMaxX + 50, y: centerPoint.y - 20 },
{ x: polygonMaxX + 50, y: centerPoint.y + height / 2 },
{ x: polygonMaxX + 50, y: centerPoint.y + 20 + height / 2 },
{ x: polygonMaxX + 80, y: centerPoint.y + 20 + height / 2 },
{ x: polygonMaxX + 80, y: centerPoint.y + 50 + height / 2 },
{ x: polygonMaxX + 110, y: centerPoint.y + height / 2 },
{ x: polygonMaxX + 80, y: centerPoint.y - 50 + height / 2 },
{ x: polygonMaxX + 80, y: centerPoint.y - 20 + height / 2 },
{ x: polygonMaxX + 50, y: centerPoint.y - 20 + height / 2 },
]
stickeyPoint = { x: polygonMaxX + 110, y: centerPoint.y }
stickeyPoint = { x: polygonMaxX + 110, y: centerPoint.y + height / 2 }
break
}