Skip to content
Snippets Groups Projects
Commit 6274a52e authored by Reiter, Christoph's avatar Reiter, Christoph :snake:
Browse files

Always enable the mask

We use it for user feedback now, so there is no good reason to allow disabling it.
parent 12bd919c
No related branches found
No related tags found
No related merge requests found
Pipeline #13640 passed
...@@ -28,8 +28,6 @@ a box under the video canvas with the read QR code data ...@@ -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 - `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. 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>` - 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 ## Events
......
...@@ -83,7 +83,6 @@ export class QrCodeScanner extends ScopedElementsMixin(DBPLitElement) { ...@@ -83,7 +83,6 @@ export class QrCodeScanner extends ScopedElementsMixin(DBPLitElement) {
this.activeCamera = ''; this.activeCamera = '';
this.sourceChanged = false; this.sourceChanged = false;
this.clipMask = false;
this._devices = new Map(); this._devices = new Map();
this._requestID = null; this._requestID = null;
this._loadingMessage = ''; this._loadingMessage = '';
...@@ -112,7 +111,6 @@ export class QrCodeScanner extends ScopedElementsMixin(DBPLitElement) { ...@@ -112,7 +111,6 @@ export class QrCodeScanner extends ScopedElementsMixin(DBPLitElement) {
stopScan: { type: Boolean, attribute: 'stop-scan' }, stopScan: { type: Boolean, attribute: 'stop-scan' },
activeCamera: { type: String, attribute: false }, activeCamera: { type: String, attribute: false },
sourceChanged: { type: Boolean, attribute: false }, sourceChanged: { type: Boolean, attribute: false },
clipMask: { type: Boolean, attribute: 'clip-mask' },
_devices: { type: Map, attribute: false}, _devices: { type: Map, attribute: false},
_loadingMessage: { type: String, attribute: false }, _loadingMessage: { type: String, attribute: false },
matchRegex: { type: String, attribute: 'match-regex' }, matchRegex: { type: String, attribute: 'match-regex' },
...@@ -255,14 +253,12 @@ export class QrCodeScanner extends ScopedElementsMixin(DBPLitElement) { ...@@ -255,14 +253,12 @@ export class QrCodeScanner extends ScopedElementsMixin(DBPLitElement) {
let maskStartX = 0; let maskStartX = 0;
let maskStartY = 0; let maskStartY = 0;
if (that.clipMask) { let maxSize = canvasElement.width > canvasElement.height ? canvasElement.height/4 * 3 : canvasElement.width/4 * 3;
let maxSize = canvasElement.width > canvasElement.height ? canvasElement.height/4 * 3 : canvasElement.width/4 * 3; console.assert(maxSize <= canvasElement.width && maxSize <= canvasElement.height);
console.assert(maxSize <= canvasElement.width && maxSize <= canvasElement.height); maskWidth = maxSize;
maskWidth = maxSize; maskHeight = maxSize;
maskHeight = maxSize; maskStartX = canvasElement.width/2 - maskWidth/2;
maskStartX = canvasElement.width/2 - maskWidth/2; maskStartY = canvasElement.height/2 - maskHeight/2;
maskStartY = canvasElement.height/2 - maskHeight/2;
}
let code = null; let code = null;
// We only check for QR codes 5 times a second to improve performance // We only check for QR codes 5 times a second to improve performance
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment