Compare commits
No commits in common. "31f2c591f73ab7fa79efead066547802daa209e7" and "a3d2ef7ca5bc8543a9f490bf578ab5738a8b1ea2" have entirely different histories.
31f2c591f7
...
a3d2ef7ca5
@ -109,10 +109,10 @@ export default function CircuitTrestleSetting({ id }) {
|
|||||||
|
|
||||||
const capture = (type) => {
|
const capture = (type) => {
|
||||||
beforeCapture()
|
beforeCapture()
|
||||||
|
setTimeout(() => {
|
||||||
handleCanvasToPng(type)
|
handleCanvasToPng(type)
|
||||||
|
afterCapture()
|
||||||
afterCapture()
|
}, 1000)
|
||||||
|
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
@ -124,22 +124,8 @@ export default function CircuitTrestleSetting({ id }) {
|
|||||||
// 캡쳐 전 처리
|
// 캡쳐 전 처리
|
||||||
const beforeCapture = () => {
|
const beforeCapture = () => {
|
||||||
// setCanvasZoom(100)
|
// setCanvasZoom(100)
|
||||||
const arrows = canvas.getObjects().filter((obj) => obj.name === 'arrow')
|
const x = 0
|
||||||
|
const y = 0
|
||||||
let x,y
|
|
||||||
|
|
||||||
x = canvas.width / 2
|
|
||||||
y = canvas.height / 2
|
|
||||||
|
|
||||||
// 화살표가 음수 영역에 있을 경우 0,0 기준으로 50% 축소
|
|
||||||
if(arrows.every((arrow) => arrow.left > 0) && arrows.every((arrow) => arrow.top > 0)) {
|
|
||||||
x = 0
|
|
||||||
y = 0
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
canvas.zoomToPoint(new fabric.Point(x, y), 0.5)
|
canvas.zoomToPoint(new fabric.Point(x, y), 0.5)
|
||||||
changeFontSize('lengthText', '28')
|
changeFontSize('lengthText', '28')
|
||||||
changeFontSize('circuitNumber', '28')
|
changeFontSize('circuitNumber', '28')
|
||||||
|
|||||||
@ -811,7 +811,7 @@ export const useTrestle = () => {
|
|||||||
return -surfaceCompass
|
return -surfaceCompass
|
||||||
}
|
}
|
||||||
|
|
||||||
let resultAzimuth = moduleCompass
|
let resultAzimuth = surfaceCompass || moduleCompass
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -840,7 +840,7 @@ export const useTrestle = () => {
|
|||||||
if (resultAzimuth > 90) {
|
if (resultAzimuth > 90) {
|
||||||
return -180 + (resultAzimuth - 90)
|
return -180 + (resultAzimuth - 90)
|
||||||
}
|
}
|
||||||
return 180 + (resultAzimuth - 90)
|
return 180 + (90 - resultAzimuth)
|
||||||
} else if (resultAzimuth === 180) {
|
} else if (resultAzimuth === 180) {
|
||||||
return -180 + (resultAzimuth - 90)
|
return -180 + (resultAzimuth - 90)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -710,34 +710,9 @@ export function useAuxiliaryDrawing(id, isUseEffect = true) {
|
|||||||
|
|
||||||
//보조선과 만나는 점을 찾는다.
|
//보조선과 만나는 점을 찾는다.
|
||||||
innerLines.forEach((line2) => {
|
innerLines.forEach((line2) => {
|
||||||
// line1이 canvas에 없는 경우 return
|
|
||||||
if (!canvas.getObjects().includes(line1)) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if (line1 === line2) {
|
if (line1 === line2) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// const originLine1 = {
|
|
||||||
// stroke : line1.stroke,
|
|
||||||
// strokeWidth: line1.strokeWidth
|
|
||||||
// }
|
|
||||||
// const originLine2 = {
|
|
||||||
// stroke: line2.stroke,
|
|
||||||
// strokeWidth: line2.strokeWidth
|
|
||||||
// }
|
|
||||||
// line1.set({stroke: 'red', strokeWidth: 10})
|
|
||||||
// line2.set({stroke: 'blue', strokeWidth: 10})
|
|
||||||
//
|
|
||||||
// canvas.renderAll()
|
|
||||||
//
|
|
||||||
// debugger
|
|
||||||
//
|
|
||||||
// line1.set(originLine1)
|
|
||||||
// line2.set(originLine2)
|
|
||||||
// canvas.renderAll()
|
|
||||||
|
|
||||||
|
|
||||||
const intersectionPoint = calculateIntersection(line1, line2)
|
const intersectionPoint = calculateIntersection(line1, line2)
|
||||||
if (!intersectionPoint) {
|
if (!intersectionPoint) {
|
||||||
return
|
return
|
||||||
@ -748,7 +723,7 @@ export function useAuxiliaryDrawing(id, isUseEffect = true) {
|
|||||||
const distance1 = distanceBetweenPoints({ x: line1.x1, y: line1.y1 }, intersectionPoint)
|
const distance1 = distanceBetweenPoints({ x: line1.x1, y: line1.y1 }, intersectionPoint)
|
||||||
const distance2 = distanceBetweenPoints({ x: line1.x2, y: line1.y2 }, intersectionPoint)
|
const distance2 = distanceBetweenPoints({ x: line1.x2, y: line1.y2 }, intersectionPoint)
|
||||||
|
|
||||||
if (distance1 < 2 || distance2 < 2) {
|
if (distance1 < 1 || distance2 < 1) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
//historyLine에서 기존 line을 제거한다.
|
//historyLine에서 기존 line을 제거한다.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user