diff --git a/src/components/fabric/QPolygon.js b/src/components/fabric/QPolygon.js index bdca82aa..43e39fd2 100644 --- a/src/components/fabric/QPolygon.js +++ b/src/components/fabric/QPolygon.js @@ -81,7 +81,7 @@ export default class QPolygon extends fabric.Group { }) this.getObjects().forEach((obj) => { - if (obj.type === 'QLine') { + if (obj.type[0] === 'Q') { obj.setFontSize(fontSize) } }) diff --git a/src/util/canvas-util.js b/src/util/canvas-util.js index 769329bb..51634a00 100644 --- a/src/util/canvas-util.js +++ b/src/util/canvas-util.js @@ -222,8 +222,16 @@ export const getRoofHypotenuse = (base) => { return Math.sqrt(base * base * 2) } +/** + * 촌을 입력받아 각도를 반환 + * @param chon + * @returns {number} + */ export const getDegreeByChon = (chon) => { - return chon * 5.45 + // tan(theta) = height / base + const radians = Math.atan(chon / 10) + // 라디안을 도 단위로 변환 + return Number((radians * (180 / Math.PI)).toFixed(2)) } /** @@ -265,6 +273,12 @@ export const getDirectionByPoint = (a, b) => { } } +/** + * line을 두개를 이용해서 교차점을 찾는 함수 + * @param line1 + * @param line2 + * @returns {{x: number, y: number}|null} + */ export function calculateIntersection(line1, line2) { const x1 = line1.x1, y1 = line1.y1,