빗변 텍스트 추가 (주석으로 처리해놓음), 이미지 저장시 가이드 라인 삭제

This commit is contained in:
yjnoh 2024-08-20 16:47:59 +09:00
parent bd310cc817
commit a7a6a26be1
2 changed files with 10 additions and 2 deletions

View File

@ -503,8 +503,8 @@ export function useCanvas(id) {
* @param {string} title - 저장할 이미지 이름 * @param {string} title - 저장할 이미지 이름
*/ */
const saveImage = (title = 'canvas') => { const saveImage = (title = 'canvas') => {
removeMouseLines()
const dataURL = canvas?.toDataURL('png') const dataURL = canvas?.toDataURL('png')
// 이미지 다운로드 링크 생성 // 이미지 다운로드 링크 생성
const link = document.createElement('a') const link = document.createElement('a')
link.download = `${title}.png` link.download = `${title}.png`
@ -627,5 +627,6 @@ export function useCanvas(id) {
handleFlip, handleFlip,
setCanvasBackgroundWithDots, setCanvasBackgroundWithDots,
addCanvas, addCanvas,
removeMouseLines,
} }
} }

View File

@ -7,6 +7,8 @@ import {
getDirection, getDirection,
getStartIndex, getStartIndex,
rearrangeArray, rearrangeArray,
getRoofHeight,
getDegreeByChon,
} from '@/util/canvas-util' } from '@/util/canvas-util'
import { useRecoilState, useRecoilValue } from 'recoil' import { useRecoilState, useRecoilValue } from 'recoil'
@ -1351,7 +1353,7 @@ export function useMode() {
const applyTemplateA = () => { const applyTemplateA = () => {
changeMode(canvas, Mode.EDIT) changeMode(canvas, Mode.EDIT)
const polygon = drawWallPolygon(false) const polygon = drawWallPolygon(false)
handleClear() // handleClear()
if (polygon.lines.length === 4) { if (polygon.lines.length === 4) {
//4각형 //4각형
@ -1538,6 +1540,7 @@ export function useMode() {
lines.push(line) lines.push(line)
canvas.add(line) canvas.add(line)
} }
canvas?.remove(polygon) //폴리곤
let highLineLength = 0 let highLineLength = 0
let lowLineLength = 0 let lowLineLength = 0
@ -1644,6 +1647,10 @@ export function useMode() {
) )
canvas.add(horiCenterLine1) canvas.add(horiCenterLine1)
//나중에 기울기 길이 적용할때 쓸라고 대충 냅둠
// canvas?.renderAll()
// console.log('horiCenterLine1', horiCenterLine1)
// horiCenterLine1.text.set('text', getRoofHeight(horiCenterLine1.length, getDegreeByChon(4)).toString())
let horiCenterLine2 = new QLine( let horiCenterLine2 = new QLine(
[ [