From 14e353a6de8366728f1c708f271c5eb2075d4690 Mon Sep 17 00:00:00 2001 From: tamaina Date: Sun, 31 Aug 2025 03:27:26 +0900 Subject: [PATCH] =?UTF-8?q?=E5=85=A8=E7=94=BB=E9=9D=A2=E3=81=A7QR=E3=82=92?= =?UTF-8?q?=E8=AA=AD=E3=82=80=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/frontend/src/pages/qr.read.vue | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/packages/frontend/src/pages/qr.read.vue b/packages/frontend/src/pages/qr.read.vue index d808cd8d82..ed3d5d5e9b 100644 --- a/packages/frontend/src/pages/qr.read.vue +++ b/packages/frontend/src/pages/qr.read.vue @@ -221,6 +221,18 @@ onMounted(() => { highlightScanRegion: true, highlightCodeOutline: true, overlay: overlayEl.value, + calculateScanRegion(video: HTMLVideoElement): QrScanner.ScanRegion { + const aspectRatio = video.videoWidth / video.videoHeight; + const SHORT_SIDE_SIZE_DOWNSCALED = 360; + return { + x: 0, + y: 0, + width: video.videoWidth, + height: video.videoHeight, + downScaledWidth: aspectRatio > 1 ? Math.round(SHORT_SIDE_SIZE_DOWNSCALED * aspectRatio) : SHORT_SIDE_SIZE_DOWNSCALED, + downScaledHeight: aspectRatio > 1 ? SHORT_SIDE_SIZE_DOWNSCALED : Math.round(SHORT_SIDE_SIZE_DOWNSCALED / aspectRatio), + }; + }, onDecodeError(err) { if (err.toString().includes('No QR code found')) return; if (alertLock.value) return;