From 6274a52e6f864efbef00e381dd94c4f77cdf4caa Mon Sep 17 00:00:00 2001
From: Christoph Reiter <reiter.christoph@gmail.com>
Date: Wed, 21 Oct 2020 15:50:36 +0200
Subject: [PATCH] Always enable the mask

We use it for user feedback now, so there is no good reason to allow disabling it.
---
 packages/qr-code-scanner/README.md              |  2 --
 packages/qr-code-scanner/src/qr-code-scanner.js | 16 ++++++----------
 2 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/packages/qr-code-scanner/README.md b/packages/qr-code-scanner/README.md
index f62262b9..08a10232 100644
--- a/packages/qr-code-scanner/README.md
+++ b/packages/qr-code-scanner/README.md
@@ -28,8 +28,6 @@ a box under the video canvas with the read QR code data
 - `stop-scan` (optional, default: `false`): set to `true` when you don't want to start the QR code reader immediatly
 after loaded. This attribute is also used to stop the QR code reader or if you don't need it anymore.
     - example `<dbp-qr-code-scanner stop-scan></dbp-qr-code-scanner>`
-- `clip-mask` (optional, default: `true`): set to `false` when you don't want to use a QR code reader with a mask for better perfomance
-    - example `<dbp-qr-code-scanner clip-mask></dbp-qr-code-scanner>`
 
 ## Events
 
diff --git a/packages/qr-code-scanner/src/qr-code-scanner.js b/packages/qr-code-scanner/src/qr-code-scanner.js
index 191430dd..345ac46d 100644
--- a/packages/qr-code-scanner/src/qr-code-scanner.js
+++ b/packages/qr-code-scanner/src/qr-code-scanner.js
@@ -83,7 +83,6 @@ export class QrCodeScanner extends ScopedElementsMixin(DBPLitElement) {
         this.activeCamera = '';
         this.sourceChanged = false;
 
-        this.clipMask = false;
         this._devices = new Map();
         this._requestID = null;
         this._loadingMessage = '';
@@ -112,7 +111,6 @@ export class QrCodeScanner extends ScopedElementsMixin(DBPLitElement) {
             stopScan: { type: Boolean, attribute: 'stop-scan' },
             activeCamera: { type: String, attribute: false },
             sourceChanged: { type: Boolean, attribute: false },
-            clipMask: { type: Boolean, attribute: 'clip-mask' },
             _devices: { type: Map, attribute: false},
             _loadingMessage: { type: String, attribute: false },
             matchRegex: { type: String, attribute: 'match-regex' },
@@ -255,14 +253,12 @@ export class QrCodeScanner extends ScopedElementsMixin(DBPLitElement) {
                 let maskStartX = 0;
                 let maskStartY = 0;
 
-                if (that.clipMask) {
-                    let maxSize = canvasElement.width > canvasElement.height ? canvasElement.height/4 * 3 : canvasElement.width/4 * 3;
-                    console.assert(maxSize <= canvasElement.width && maxSize <= canvasElement.height);
-                    maskWidth = maxSize;
-                    maskHeight = maxSize;
-                    maskStartX = canvasElement.width/2 - maskWidth/2;
-                    maskStartY = canvasElement.height/2 - maskHeight/2;
-                }
+                let maxSize = canvasElement.width > canvasElement.height ? canvasElement.height/4 * 3 : canvasElement.width/4 * 3;
+                console.assert(maxSize <= canvasElement.width && maxSize <= canvasElement.height);
+                maskWidth = maxSize;
+                maskHeight = maxSize;
+                maskStartX = canvasElement.width/2 - maskWidth/2;
+                maskStartY = canvasElement.height/2 - maskHeight/2;
 
                 let code = null;
                 // We only check for QR codes 5 times a second to improve performance
-- 
GitLab