Merge pull request 'dev' (#186) from dev into prd-deploy

Reviewed-on: #186
This commit is contained in:
ysCha 2025-07-07 17:48:33 +09:00
commit 71d774bf88
3 changed files with 48 additions and 9 deletions

View File

@ -109,10 +109,10 @@ export default function CircuitTrestleSetting({ id }) {
const capture = (type) => {
beforeCapture()
setTimeout(() => {
handleCanvasToPng(type)
afterCapture()
}, 1000)
handleCanvasToPng(type)
afterCapture()
return new Promise((resolve) => {
setTimeout(() => {
@ -124,8 +124,22 @@ export default function CircuitTrestleSetting({ id }) {
//
const beforeCapture = () => {
// setCanvasZoom(100)
const x = 0
const y = 0
const arrows = canvas.getObjects().filter((obj) => obj.name === 'arrow')
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)
changeFontSize('lengthText', '28')
changeFontSize('circuitNumber', '28')

View File

@ -811,7 +811,7 @@ export const useTrestle = () => {
return -surfaceCompass
}
let resultAzimuth = surfaceCompass || moduleCompass
let resultAzimuth = moduleCompass
@ -840,7 +840,7 @@ export const useTrestle = () => {
if (resultAzimuth > 90) {
return -180 + (resultAzimuth - 90)
}
return 180 + (90 - resultAzimuth)
return 180 + (resultAzimuth - 90)
} else if (resultAzimuth === 180) {
return -180 + (resultAzimuth - 90)
}

View File

@ -710,9 +710,34 @@ export function useAuxiliaryDrawing(id, isUseEffect = true) {
//보조선과 만나는 점을 찾는다.
innerLines.forEach((line2) => {
// line1이 canvas에 없는 경우 return
if (!canvas.getObjects().includes(line1)) {
return
}
if (line1 === line2) {
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)
if (!intersectionPoint) {
return
@ -723,7 +748,7 @@ export function useAuxiliaryDrawing(id, isUseEffect = true) {
const distance1 = distanceBetweenPoints({ x: line1.x1, y: line1.y1 }, intersectionPoint)
const distance2 = distanceBetweenPoints({ x: line1.x2, y: line1.y2 }, intersectionPoint)
if (distance1 < 1 || distance2 < 1) {
if (distance1 < 2 || distance2 < 2) {
return
}
//historyLine에서 기존 line을 제거한다.