Skip to content

Commit 437a5a3

Browse files
committed
add textDecoder option to DOM package
1 parent bc5649a commit 437a5a3

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/dom.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ export type QRCanvasOpts = {
6262
overlaySideColor: string;
6363
overlayTimeout: number; // how must time from last detect until hide overlay stuff
6464
cropToSquare: boolean; // crop image to square
65+
textDecoder?: (bytes: Uint8Array) => string;
6566
};
6667

6768
export type QRCanvasElements = {
@@ -182,7 +183,10 @@ export class QRCanvas {
182183
const { context } = this.main;
183184
context.drawImage(image, 0, 0, width, height);
184185
const data = context.getImageData(0, 0, width, height);
185-
const options: DecodeOpts = { cropToSquare: this.opts.cropToSquare };
186+
const options: DecodeOpts = {
187+
cropToSquare: this.opts.cropToSquare,
188+
textDecoder: this.opts.textDecoder,
189+
};
186190
if (this.bitmap) options.imageOnBitmap = (img) => this.drawBitmap(img);
187191
if (this.overlay) options.pointsOnDetect = (points) => this.drawOverlay(points);
188192
if (this.resultQR) options.imageOnResult = (img) => this.drawResultQr(img);

0 commit comments

Comments
 (0)