Upgrade vue-qr-code-reader and fix scanning issue

This commit is contained in:
Dennis Reimann
2021-10-21 15:22:51 +02:00
committed by Andrew Camilleri
parent 926b60df3d
commit 493f1b98c2
3 changed files with 16 additions and 12 deletions

View File

@@ -172,18 +172,21 @@ function initCameraScanningApp(title, onDataSubmit, modalId) {
logErrors(promise) { logErrors(promise) {
promise.catch(console.error) promise.catch(console.error)
}, },
paint(location, ctx) { paint(detectedCodes, ctx) {
ctx.fillStyle = '#137547'; for (const detectedCode of detectedCodes) {
[ const [ firstPoint, ...otherPoints ] = detectedCode.cornerPoints
location.topLeftFinderPattern, ctx.strokeStyle = "#51b13e";
location.topRightFinderPattern, ctx.beginPath();
location.bottomLeftFinderPattern ctx.moveTo(firstPoint.x, firstPoint.y);
].forEach(({ x, y }) => { for (const { x, y } of otherPoints) {
ctx.fillRect(x - 5, y - 5, 10, 10); ctx.lineTo(x, y);
}) }
ctx.lineTo(firstPoint.x, firstPoint.y);
ctx.closePath();
ctx.stroke();
}
}, },
onInit(promise) { onInit(promise) {
promise.then(() => { promise.then(() => {
this.errorMessage = null; this.errorMessage = null;
if (app.cameras.length === 1) if (app.cameras.length === 1)

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long