From 7ccdda6405e8cf4d017b1aa434a8d075dae254df Mon Sep 17 00:00:00 2001 From: "hyojun.choi" Date: Mon, 7 Jul 2025 17:05:59 +0900 Subject: [PATCH] =?UTF-8?q?=EC=BA=A1=EC=B3=90=20=EC=A0=84=20=EC=B2=98?= =?UTF-8?q?=EB=A6=AC=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../circuitTrestle/CircuitTrestleSetting.jsx | 26 ++++++++++++++----- 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/src/components/floor-plan/modal/circuitTrestle/CircuitTrestleSetting.jsx b/src/components/floor-plan/modal/circuitTrestle/CircuitTrestleSetting.jsx index 2e301026..bf3c40cc 100644 --- a/src/components/floor-plan/modal/circuitTrestle/CircuitTrestleSetting.jsx +++ b/src/components/floor-plan/modal/circuitTrestle/CircuitTrestleSetting.jsx @@ -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')