From 94eb6d0b0ecc1bc2973902ebb1a0b62e2a8a6a40 Mon Sep 17 00:00:00 2001 From: Bunlong Date: Mon, 14 Nov 2022 23:44:25 +0700 Subject: [PATCH] Refactor --- src/useQRCode.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/useQRCode.tsx b/src/useQRCode.tsx index df9b72d..7f8e166 100644 --- a/src/useQRCode.tsx +++ b/src/useQRCode.tsx @@ -101,8 +101,8 @@ function useCanvasComponent() { }; } else if (!logo?.options?.x || !logo?.options?.y) { let margin = options?.margin; - margin = !margin ? (margin === 0 ? 0 : 32) : (margin * 8); - const width = options?.width || (116 + margin); + margin = !margin ? (margin === 0 ? 0 : 32) : margin * 8; + const width = options?.width || 116 + margin; const center = (width - logoWidth) / 2; img.onload = function () { ctx.drawImage(img, center, center, logoWidth, logoWidth);