From 825fca0fa15fa58a5f2beae84a181b826af84248 Mon Sep 17 00:00:00 2001 From: "hyojun.choi" Date: Mon, 2 Feb 2026 10:16:26 +0900 Subject: [PATCH] =?UTF-8?q?=EC=9D=B4=EB=AF=B8=EC=A7=80=20=EC=BA=A1?= =?UTF-8?q?=EC=B3=90=20=EC=8B=9C=20=ED=95=B4=EC=83=81=EB=A0=A5=202?= =?UTF-8?q?=EB=B0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/floorPlan/useImgLoader.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/hooks/floorPlan/useImgLoader.js b/src/hooks/floorPlan/useImgLoader.js index 242206db..81383f13 100644 --- a/src/hooks/floorPlan/useImgLoader.js +++ b/src/hooks/floorPlan/useImgLoader.js @@ -58,7 +58,12 @@ export function useImgLoader() { canvas.renderAll() const formData = new FormData() - const dataUrl = canvas.toDataURL('image/png') + // 고해상도 캡처를 위해 multiplier 옵션 추가 (2배 해상도) + const multiplier = 2 + const dataUrl = canvas.toDataURL({ + format: 'png', + multiplier: multiplier, + }) const blobBin = atob(dataUrl.split(',')[1]) const array = [] for (let i = 0; i < blobBin.length; i++) { @@ -69,13 +74,13 @@ export function useImgLoader() { formData.append('objectNo', currentCanvasPlan.objectNo) formData.append('planNo', currentCanvasPlan.planNo) formData.append('type', type) - /** 이미지 크롭 좌표 계산 */ + /** 이미지 크롭 좌표 계산 (multiplier 배율 적용) */ const positionObj = getImageCoordinates() console.log('🚀 ~ handleCanvasToPng ~ positionObj:', positionObj) - formData.append('width', Math.round(positionObj[1].x - positionObj[0].x + 100)) - formData.append('height', Math.round(positionObj[1].y - positionObj[0].y + 100)) - formData.append('left', Math.round(positionObj[0].x)) - formData.append('top', Math.round(positionObj[0].y)) + formData.append('width', Math.round((positionObj[1].x - positionObj[0].x + 100) * multiplier)) + formData.append('height', Math.round((positionObj[1].y - positionObj[0].y + 100) * multiplier)) + formData.append('left', Math.round(positionObj[0].x * multiplier)) + formData.append('top', Math.round(positionObj[0].y * multiplier)) console.log('🚀 ~ handleCanvasToPng ~ formData:', formData) /** 이미지 크롭 요청 */