全画面でQRを読むように

This commit is contained in:
tamaina 2025-08-31 03:27:26 +09:00
parent 7ddb012260
commit 14e353a6de
1 changed files with 12 additions and 0 deletions

View File

@ -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;