From befa12b00b3674e08bc5767d0744b259f55257f9 Mon Sep 17 00:00:00 2001 From: "hyojun.choi" Date: Mon, 27 Oct 2025 14:38:25 +0900 Subject: [PATCH] =?UTF-8?q?=EA=B8=B8=EC=9D=B4=20=EC=9C=84=EC=B9=98=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/fabric/QPolygon.js | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/components/fabric/QPolygon.js b/src/components/fabric/QPolygon.js index 46fbb931..1c2e3d65 100644 --- a/src/components/fabric/QPolygon.js +++ b/src/components/fabric/QPolygon.js @@ -6,7 +6,6 @@ import { calculateAngle, drawGableRoof, drawRidgeRoof, drawShedRoof, toGeoJSON } import * as turf from '@turf/turf' import { LINE_TYPE, POLYGON_TYPE } from '@/common/common' import Big from 'big.js' -import { drawSkeletonRidgeRoof } from '@/util/skeleton-utils' export const QPolygon = fabric.util.createClass(fabric.Polygon, { type: 'QPolygon', @@ -376,9 +375,27 @@ export const QPolygon = fabric.util.createClass(fabric.Polygon, { const dy = Big(end.y).minus(Big(start.y)) const length = dx.pow(2).plus(dy.pow(2)).sqrt().times(10).round().toNumber() + const direction = getDirectionByPoint(start, end) + + let left, top + + if (direction === 'bottom') { + left = (start.x + end.x) / 2 - 50 + top = (start.y + end.y) / 2 + } else if (direction === 'top') { + left = (start.x + end.x) / 2 + 30 + top = (start.y + end.y) / 2 + } else if (direction === 'left') { + left = (start.x + end.x) / 2 + top = (start.y + end.y) / 2 - 30 + } else if (direction === 'right') { + left = (start.x + end.x) / 2 + top = (start.y + end.y) / 2 + 30 + } + let midPoint - midPoint = new fabric.Point((start.x + end.x) / 2, (start.y + end.y) / 2) + midPoint = new fabric.Point(left, top) const degree = Big(Math.atan2(dy.toNumber(), dx.toNumber())).times(180).div(Math.PI).toNumber()