캡쳐 전 처리 수정
This commit is contained in:
parent
a4d74bb41b
commit
7ccdda6405
@ -109,10 +109,10 @@ export default function CircuitTrestleSetting({ id }) {
|
||||
|
||||
const capture = (type) => {
|
||||
beforeCapture()
|
||||
setTimeout(() => {
|
||||
|
||||
handleCanvasToPng(type)
|
||||
|
||||
afterCapture()
|
||||
}, 1000)
|
||||
|
||||
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')
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user