@twintag/twintag-core 0.2.279-fix-ocr-scanner-update-ca129a0ddafcef2f7b1df1960cc45889702617c1 → 0.2.279-fix-ocr-scanner-update-ec42ca951c4f16b77ca0afa9f41095303b05aeea

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -14,7 +14,7 @@ const patchEsm = () => {
14
14
  const defineCustomElements = (win, options) => {
15
15
  if (typeof window === 'undefined') return Promise.resolve();
16
16
  return patchEsm().then(() => {
17
- return index.bootstrapLazy([["twintag-preview.cjs",[[1,"twintag-preview",{"item":[1],"initial":[16],"smoothExtinction":[2,"smooth-extinction"],"extension":[1],"showButtons":[4,"show-buttons"],"previewableItem":[32],"type":[32]}]]],["twintag-auth-callback.cjs",[[1,"twintag-auth-callback"]]],["twintag-auth-logout.cjs",[[1,"twintag-auth-logout"]]],["twintag-media.cjs",[[1,"twintag-media",{"first":[1],"middle":[1],"last":[1]}]]],["twintag-ocr-scanner.cjs",[[1,"twintag-ocr-scanner",{"stream":[1040],"cropX":[2,"crop-x"],"cropY":[2,"crop-y"],"zoom":[514],"devices":[32]},[[2,"recognize","ocrHandler"]]]]],["twintag-offline-actions.cjs",[[1,"twintag-offline-actions",{"enableSingleRetry":[4,"enable-single-retry"],"header":[1],"showTimestamp":[4,"show-timestamp"],"showDescription":[4,"show-description"],"closeText":[1,"close-text"],"retryText":[1,"retry-text"],"noPendingActionsText":[1,"no-pending-actions-text"],"pendingOfflineRequests":[32],"processing":[32]},[[8,"offlineRequestsChanged","offlineRequestsChangedHandler"]]]]],["twintag-offline-state.cjs",[[1,"twintag-offline-state",{"onlineState":[32],"pendingRequests":[32]},[[8,"onlineChanged","onlineChangedHandler"],[8,"offlineRequestsChanged","offlineRequestsChangedHandler"]]]]],["twintag-offline-support.cjs",[[1,"twintag-offline-support",{"autoSync":[4,"auto-sync"],"forceOffline":[4,"force-offline"],"config":[16]}]]],["twintag-qr-scanner.cjs",[[1,"twintag-qr-scanner",{"stream":[1040],"mode":[1],"format":[1],"crop":[2],"zoom":[514],"devices":[32]}]]],["twintag-share.cjs",[[1,"twintag-share",{"url":[1],"modalTitle":[1,"modal-title"],"modalSubtitle":[1,"modal-subtitle"],"closeBtn":[1,"close-btn"],"copyClipboardBtn":[1,"copy-clipboard-btn"],"open":[1540]},[[0,"keydown","handleKeyDown"]]]]],["twintag-spinner.cjs",[[1,"twintag-spinner",{"color":[513],"duration":[2],"name":[1]}]]],["twintag-pdf-viewer.cjs",[[0,"twintag-pdf-viewer",{"src":[1],"fileName":[1,"file-name"],"file":[32],"fileURL":[32]}]]]], options);
17
+ return index.bootstrapLazy([["twintag-preview.cjs",[[1,"twintag-preview",{"item":[1],"initial":[16],"smoothExtinction":[2,"smooth-extinction"],"extension":[1],"showButtons":[4,"show-buttons"],"previewableItem":[32],"type":[32]}]]],["twintag-auth-callback.cjs",[[1,"twintag-auth-callback"]]],["twintag-auth-logout.cjs",[[1,"twintag-auth-logout"]]],["twintag-media.cjs",[[1,"twintag-media",{"first":[1],"middle":[1],"last":[1]}]]],["twintag-ocr-scanner.cjs",[[1,"twintag-ocr-scanner",{"stream":[1040],"mode":[1],"cropX":[2,"crop-x"],"cropY":[2,"crop-y"],"zoom":[514],"devices":[32]},[[2,"recognize","ocrHandler"]]]]],["twintag-offline-actions.cjs",[[1,"twintag-offline-actions",{"enableSingleRetry":[4,"enable-single-retry"],"header":[1],"showTimestamp":[4,"show-timestamp"],"showDescription":[4,"show-description"],"closeText":[1,"close-text"],"retryText":[1,"retry-text"],"noPendingActionsText":[1,"no-pending-actions-text"],"pendingOfflineRequests":[32],"processing":[32]},[[8,"offlineRequestsChanged","offlineRequestsChangedHandler"]]]]],["twintag-offline-state.cjs",[[1,"twintag-offline-state",{"onlineState":[32],"pendingRequests":[32]},[[8,"onlineChanged","onlineChangedHandler"],[8,"offlineRequestsChanged","offlineRequestsChangedHandler"]]]]],["twintag-offline-support.cjs",[[1,"twintag-offline-support",{"autoSync":[4,"auto-sync"],"forceOffline":[4,"force-offline"],"config":[16]}]]],["twintag-qr-scanner.cjs",[[1,"twintag-qr-scanner",{"stream":[1040],"mode":[1],"format":[1],"crop":[2],"zoom":[514],"devices":[32]}]]],["twintag-share.cjs",[[1,"twintag-share",{"url":[1],"modalTitle":[1,"modal-title"],"modalSubtitle":[1,"modal-subtitle"],"closeBtn":[1,"close-btn"],"copyClipboardBtn":[1,"copy-clipboard-btn"],"open":[1540]},[[0,"keydown","handleKeyDown"]]]]],["twintag-spinner.cjs",[[1,"twintag-spinner",{"color":[513],"duration":[2],"name":[1]}]]],["twintag-pdf-viewer.cjs",[[0,"twintag-pdf-viewer",{"src":[1],"fileName":[1,"file-name"],"file":[32],"fileURL":[32]}]]]], options);
18
18
  });
19
19
  };
20
20
 
@@ -15,5 +15,5 @@ const patchBrowser = () => {
15
15
  };
16
16
 
17
17
  patchBrowser().then(options => {
18
- return index.bootstrapLazy([["twintag-preview.cjs",[[1,"twintag-preview",{"item":[1],"initial":[16],"smoothExtinction":[2,"smooth-extinction"],"extension":[1],"showButtons":[4,"show-buttons"],"previewableItem":[32],"type":[32]}]]],["twintag-auth-callback.cjs",[[1,"twintag-auth-callback"]]],["twintag-auth-logout.cjs",[[1,"twintag-auth-logout"]]],["twintag-media.cjs",[[1,"twintag-media",{"first":[1],"middle":[1],"last":[1]}]]],["twintag-ocr-scanner.cjs",[[1,"twintag-ocr-scanner",{"stream":[1040],"cropX":[2,"crop-x"],"cropY":[2,"crop-y"],"zoom":[514],"devices":[32]},[[2,"recognize","ocrHandler"]]]]],["twintag-offline-actions.cjs",[[1,"twintag-offline-actions",{"enableSingleRetry":[4,"enable-single-retry"],"header":[1],"showTimestamp":[4,"show-timestamp"],"showDescription":[4,"show-description"],"closeText":[1,"close-text"],"retryText":[1,"retry-text"],"noPendingActionsText":[1,"no-pending-actions-text"],"pendingOfflineRequests":[32],"processing":[32]},[[8,"offlineRequestsChanged","offlineRequestsChangedHandler"]]]]],["twintag-offline-state.cjs",[[1,"twintag-offline-state",{"onlineState":[32],"pendingRequests":[32]},[[8,"onlineChanged","onlineChangedHandler"],[8,"offlineRequestsChanged","offlineRequestsChangedHandler"]]]]],["twintag-offline-support.cjs",[[1,"twintag-offline-support",{"autoSync":[4,"auto-sync"],"forceOffline":[4,"force-offline"],"config":[16]}]]],["twintag-qr-scanner.cjs",[[1,"twintag-qr-scanner",{"stream":[1040],"mode":[1],"format":[1],"crop":[2],"zoom":[514],"devices":[32]}]]],["twintag-share.cjs",[[1,"twintag-share",{"url":[1],"modalTitle":[1,"modal-title"],"modalSubtitle":[1,"modal-subtitle"],"closeBtn":[1,"close-btn"],"copyClipboardBtn":[1,"copy-clipboard-btn"],"open":[1540]},[[0,"keydown","handleKeyDown"]]]]],["twintag-spinner.cjs",[[1,"twintag-spinner",{"color":[513],"duration":[2],"name":[1]}]]],["twintag-pdf-viewer.cjs",[[0,"twintag-pdf-viewer",{"src":[1],"fileName":[1,"file-name"],"file":[32],"fileURL":[32]}]]]], options);
18
+ return index.bootstrapLazy([["twintag-preview.cjs",[[1,"twintag-preview",{"item":[1],"initial":[16],"smoothExtinction":[2,"smooth-extinction"],"extension":[1],"showButtons":[4,"show-buttons"],"previewableItem":[32],"type":[32]}]]],["twintag-auth-callback.cjs",[[1,"twintag-auth-callback"]]],["twintag-auth-logout.cjs",[[1,"twintag-auth-logout"]]],["twintag-media.cjs",[[1,"twintag-media",{"first":[1],"middle":[1],"last":[1]}]]],["twintag-ocr-scanner.cjs",[[1,"twintag-ocr-scanner",{"stream":[1040],"mode":[1],"cropX":[2,"crop-x"],"cropY":[2,"crop-y"],"zoom":[514],"devices":[32]},[[2,"recognize","ocrHandler"]]]]],["twintag-offline-actions.cjs",[[1,"twintag-offline-actions",{"enableSingleRetry":[4,"enable-single-retry"],"header":[1],"showTimestamp":[4,"show-timestamp"],"showDescription":[4,"show-description"],"closeText":[1,"close-text"],"retryText":[1,"retry-text"],"noPendingActionsText":[1,"no-pending-actions-text"],"pendingOfflineRequests":[32],"processing":[32]},[[8,"offlineRequestsChanged","offlineRequestsChangedHandler"]]]]],["twintag-offline-state.cjs",[[1,"twintag-offline-state",{"onlineState":[32],"pendingRequests":[32]},[[8,"onlineChanged","onlineChangedHandler"],[8,"offlineRequestsChanged","offlineRequestsChangedHandler"]]]]],["twintag-offline-support.cjs",[[1,"twintag-offline-support",{"autoSync":[4,"auto-sync"],"forceOffline":[4,"force-offline"],"config":[16]}]]],["twintag-qr-scanner.cjs",[[1,"twintag-qr-scanner",{"stream":[1040],"mode":[1],"format":[1],"crop":[2],"zoom":[514],"devices":[32]}]]],["twintag-share.cjs",[[1,"twintag-share",{"url":[1],"modalTitle":[1,"modal-title"],"modalSubtitle":[1,"modal-subtitle"],"closeBtn":[1,"close-btn"],"copyClipboardBtn":[1,"copy-clipboard-btn"],"open":[1540]},[[0,"keydown","handleKeyDown"]]]]],["twintag-spinner.cjs",[[1,"twintag-spinner",{"color":[513],"duration":[2],"name":[1]}]]],["twintag-pdf-viewer.cjs",[[0,"twintag-pdf-viewer",{"src":[1],"fileName":[1,"file-name"],"file":[32],"fileURL":[32]}]]]], options);
19
19
  });
@@ -1901,18 +1901,25 @@ const TwintagOcrScanner = class {
1901
1901
  this.frame = index.createEvent(this, "frame", 7);
1902
1902
  this.devices = [];
1903
1903
  this.stream = null;
1904
+ this.mode = 'single';
1904
1905
  this.cropX = 1;
1905
1906
  this.cropY = 1;
1906
1907
  this.zoom = 0;
1907
1908
  }
1908
1909
  async ocrHandler() {
1910
+ this.canRecognize.emit(false);
1909
1911
  const { text, frame } = await this.readBarcodeFromCanvas();
1910
1912
  this.symbol.emit({
1911
1913
  text,
1912
1914
  format: 'OCR',
1913
1915
  });
1914
1916
  this.frame.emit(frame);
1915
- this.stopStream();
1917
+ if (this.mode === 'continuous') {
1918
+ this.canRecognize.emit(true);
1919
+ }
1920
+ if (this.mode === 'single') {
1921
+ this.stopStream();
1922
+ }
1916
1923
  }
1917
1924
  async connectedCallback() {
1918
1925
  this.worker = await src.createWorker('eng');
@@ -1938,15 +1945,15 @@ const TwintagOcrScanner = class {
1938
1945
  }
1939
1946
  drawInCanvas() {
1940
1947
  const stage = Math.min(this.video.videoWidth, this.video.videoHeight);
1941
- const xLength = stage * this.cropX;
1942
- const yLength = stage * this.cropY;
1948
+ const width = stage * this.cropX;
1949
+ const height = stage * this.cropY;
1943
1950
  const center = {
1944
1951
  x: this.video.videoWidth / 2,
1945
1952
  y: this.video.videoHeight / 2,
1946
1953
  };
1947
- const sx = center.x - xLength / 2;
1948
- const sy = center.y - yLength / 2;
1949
- this.context.drawImage(this.video, sx, sy, xLength, yLength, 0, 0, stage, stage);
1954
+ const sx = center.x - width / 2;
1955
+ const sy = center.y - height / 2;
1956
+ this.context.drawImage(this.video, sx, sy, width, height, 0, 0, width, height);
1950
1957
  }
1951
1958
  async updateStream(constraints) {
1952
1959
  if (this.stream) {
@@ -2053,8 +2060,10 @@ const TwintagOcrScanner = class {
2053
2060
  onComplete: () => {
2054
2061
  this.streamIsActive.emit(true);
2055
2062
  const stage = Math.min(this.video.videoWidth, this.video.videoHeight);
2056
- this.canvas.width = stage;
2057
- this.canvas.height = stage;
2063
+ const width = stage * this.cropX;
2064
+ const height = stage * this.cropY;
2065
+ this.canvas.width = width;
2066
+ this.canvas.height = height;
2058
2067
  this.canRecognize.emit(true);
2059
2068
  }
2060
2069
  });
@@ -206,7 +206,7 @@ class IndexedDbService {
206
206
  /**
207
207
  * The SDK version.
208
208
  */
209
- const VERSION = '0.2.279-fix-ocr-scanner-update-ca129a0ddafcef2f7b1df1960cc45889702617c1';
209
+ const VERSION = '0.2.279-fix-ocr-scanner-update-ec42ca951c4f16b77ca0afa9f41095303b05aeea';
210
210
 
211
211
  class TwintagErrorValue {
212
212
  }
@@ -5,18 +5,25 @@ export class TwintagOcrScanner {
5
5
  constructor() {
6
6
  this.devices = [];
7
7
  this.stream = null;
8
+ this.mode = 'single';
8
9
  this.cropX = 1;
9
10
  this.cropY = 1;
10
11
  this.zoom = 0;
11
12
  }
12
13
  async ocrHandler() {
14
+ this.canRecognize.emit(false);
13
15
  const { text, frame } = await this.readBarcodeFromCanvas();
14
16
  this.symbol.emit({
15
17
  text,
16
18
  format: 'OCR',
17
19
  });
18
20
  this.frame.emit(frame);
19
- this.stopStream();
21
+ if (this.mode === 'continuous') {
22
+ this.canRecognize.emit(true);
23
+ }
24
+ if (this.mode === 'single') {
25
+ this.stopStream();
26
+ }
20
27
  }
21
28
  async connectedCallback() {
22
29
  this.worker = await createWorker('eng');
@@ -42,15 +49,15 @@ export class TwintagOcrScanner {
42
49
  }
43
50
  drawInCanvas() {
44
51
  const stage = Math.min(this.video.videoWidth, this.video.videoHeight);
45
- const xLength = stage * this.cropX;
46
- const yLength = stage * this.cropY;
52
+ const width = stage * this.cropX;
53
+ const height = stage * this.cropY;
47
54
  const center = {
48
55
  x: this.video.videoWidth / 2,
49
56
  y: this.video.videoHeight / 2,
50
57
  };
51
- const sx = center.x - xLength / 2;
52
- const sy = center.y - yLength / 2;
53
- this.context.drawImage(this.video, sx, sy, xLength, yLength, 0, 0, stage, stage);
58
+ const sx = center.x - width / 2;
59
+ const sy = center.y - height / 2;
60
+ this.context.drawImage(this.video, sx, sy, width, height, 0, 0, width, height);
54
61
  }
55
62
  async updateStream(constraints) {
56
63
  if (this.stream) {
@@ -157,8 +164,10 @@ export class TwintagOcrScanner {
157
164
  onComplete: () => {
158
165
  this.streamIsActive.emit(true);
159
166
  const stage = Math.min(this.video.videoWidth, this.video.videoHeight);
160
- this.canvas.width = stage;
161
- this.canvas.height = stage;
167
+ const width = stage * this.cropX;
168
+ const height = stage * this.cropY;
169
+ this.canvas.width = width;
170
+ this.canvas.height = height;
162
171
  this.canRecognize.emit(true);
163
172
  }
164
173
  });
@@ -219,6 +228,24 @@ export class TwintagOcrScanner {
219
228
  },
220
229
  "defaultValue": "null"
221
230
  },
231
+ "mode": {
232
+ "type": "string",
233
+ "mutable": false,
234
+ "complexType": {
235
+ "original": "'single' | 'continuous'",
236
+ "resolved": "\"continuous\" | \"single\"",
237
+ "references": {}
238
+ },
239
+ "required": false,
240
+ "optional": false,
241
+ "docs": {
242
+ "tags": [],
243
+ "text": ""
244
+ },
245
+ "attribute": "mode",
246
+ "reflect": false,
247
+ "defaultValue": "'single'"
248
+ },
222
249
  "cropX": {
223
250
  "type": "number",
224
251
  "mutable": false,
@@ -2,4 +2,4 @@
2
2
  /**
3
3
  * The library version.
4
4
  */
5
- export const VERSION = '0.2.279-fix-ocr-scanner-update-ca129a0ddafcef2f7b1df1960cc45889702617c1';
5
+ export const VERSION = '0.2.279-fix-ocr-scanner-update-ec42ca951c4f16b77ca0afa9f41095303b05aeea';
@@ -1899,18 +1899,25 @@ const TwintagOcrScanner$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLE
1899
1899
  this.frame = createEvent(this, "frame", 7);
1900
1900
  this.devices = [];
1901
1901
  this.stream = null;
1902
+ this.mode = 'single';
1902
1903
  this.cropX = 1;
1903
1904
  this.cropY = 1;
1904
1905
  this.zoom = 0;
1905
1906
  }
1906
1907
  async ocrHandler() {
1908
+ this.canRecognize.emit(false);
1907
1909
  const { text, frame } = await this.readBarcodeFromCanvas();
1908
1910
  this.symbol.emit({
1909
1911
  text,
1910
1912
  format: 'OCR',
1911
1913
  });
1912
1914
  this.frame.emit(frame);
1913
- this.stopStream();
1915
+ if (this.mode === 'continuous') {
1916
+ this.canRecognize.emit(true);
1917
+ }
1918
+ if (this.mode === 'single') {
1919
+ this.stopStream();
1920
+ }
1914
1921
  }
1915
1922
  async connectedCallback() {
1916
1923
  this.worker = await src.createWorker('eng');
@@ -1936,15 +1943,15 @@ const TwintagOcrScanner$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLE
1936
1943
  }
1937
1944
  drawInCanvas() {
1938
1945
  const stage = Math.min(this.video.videoWidth, this.video.videoHeight);
1939
- const xLength = stage * this.cropX;
1940
- const yLength = stage * this.cropY;
1946
+ const width = stage * this.cropX;
1947
+ const height = stage * this.cropY;
1941
1948
  const center = {
1942
1949
  x: this.video.videoWidth / 2,
1943
1950
  y: this.video.videoHeight / 2,
1944
1951
  };
1945
- const sx = center.x - xLength / 2;
1946
- const sy = center.y - yLength / 2;
1947
- this.context.drawImage(this.video, sx, sy, xLength, yLength, 0, 0, stage, stage);
1952
+ const sx = center.x - width / 2;
1953
+ const sy = center.y - height / 2;
1954
+ this.context.drawImage(this.video, sx, sy, width, height, 0, 0, width, height);
1948
1955
  }
1949
1956
  async updateStream(constraints) {
1950
1957
  if (this.stream) {
@@ -2051,8 +2058,10 @@ const TwintagOcrScanner$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLE
2051
2058
  onComplete: () => {
2052
2059
  this.streamIsActive.emit(true);
2053
2060
  const stage = Math.min(this.video.videoWidth, this.video.videoHeight);
2054
- this.canvas.width = stage;
2055
- this.canvas.height = stage;
2061
+ const width = stage * this.cropX;
2062
+ const height = stage * this.cropY;
2063
+ this.canvas.width = width;
2064
+ this.canvas.height = height;
2056
2065
  this.canRecognize.emit(true);
2057
2066
  }
2058
2067
  });
@@ -2082,6 +2091,7 @@ const TwintagOcrScanner$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLE
2082
2091
  static get style() { return twintagScannerCss; }
2083
2092
  }, [1, "twintag-ocr-scanner", {
2084
2093
  "stream": [1040],
2094
+ "mode": [1],
2085
2095
  "cropX": [2, "crop-x"],
2086
2096
  "cropY": [2, "crop-y"],
2087
2097
  "zoom": [514],
@@ -223,7 +223,7 @@ class IndexedDbService {
223
223
  /**
224
224
  * The SDK version.
225
225
  */
226
- const VERSION = '0.2.279-fix-ocr-scanner-update-ca129a0ddafcef2f7b1df1960cc45889702617c1';
226
+ const VERSION = '0.2.279-fix-ocr-scanner-update-ec42ca951c4f16b77ca0afa9f41095303b05aeea';
227
227
 
228
228
  class TwintagErrorValue {
229
229
  }
@@ -10,7 +10,7 @@ const patchEsm = () => {
10
10
  const defineCustomElements = (win, options) => {
11
11
  if (typeof window === 'undefined') return Promise.resolve();
12
12
  return patchEsm().then(() => {
13
- return bootstrapLazy([["twintag-preview",[[1,"twintag-preview",{"item":[1],"initial":[16],"smoothExtinction":[2,"smooth-extinction"],"extension":[1],"showButtons":[4,"show-buttons"],"previewableItem":[32],"type":[32]}]]],["twintag-auth-callback",[[1,"twintag-auth-callback"]]],["twintag-auth-logout",[[1,"twintag-auth-logout"]]],["twintag-media",[[1,"twintag-media",{"first":[1],"middle":[1],"last":[1]}]]],["twintag-ocr-scanner",[[1,"twintag-ocr-scanner",{"stream":[1040],"cropX":[2,"crop-x"],"cropY":[2,"crop-y"],"zoom":[514],"devices":[32]},[[2,"recognize","ocrHandler"]]]]],["twintag-offline-actions",[[1,"twintag-offline-actions",{"enableSingleRetry":[4,"enable-single-retry"],"header":[1],"showTimestamp":[4,"show-timestamp"],"showDescription":[4,"show-description"],"closeText":[1,"close-text"],"retryText":[1,"retry-text"],"noPendingActionsText":[1,"no-pending-actions-text"],"pendingOfflineRequests":[32],"processing":[32]},[[8,"offlineRequestsChanged","offlineRequestsChangedHandler"]]]]],["twintag-offline-state",[[1,"twintag-offline-state",{"onlineState":[32],"pendingRequests":[32]},[[8,"onlineChanged","onlineChangedHandler"],[8,"offlineRequestsChanged","offlineRequestsChangedHandler"]]]]],["twintag-offline-support",[[1,"twintag-offline-support",{"autoSync":[4,"auto-sync"],"forceOffline":[4,"force-offline"],"config":[16]}]]],["twintag-qr-scanner",[[1,"twintag-qr-scanner",{"stream":[1040],"mode":[1],"format":[1],"crop":[2],"zoom":[514],"devices":[32]}]]],["twintag-share",[[1,"twintag-share",{"url":[1],"modalTitle":[1,"modal-title"],"modalSubtitle":[1,"modal-subtitle"],"closeBtn":[1,"close-btn"],"copyClipboardBtn":[1,"copy-clipboard-btn"],"open":[1540]},[[0,"keydown","handleKeyDown"]]]]],["twintag-spinner",[[1,"twintag-spinner",{"color":[513],"duration":[2],"name":[1]}]]],["twintag-pdf-viewer",[[0,"twintag-pdf-viewer",{"src":[1],"fileName":[1,"file-name"],"file":[32],"fileURL":[32]}]]]], options);
13
+ return bootstrapLazy([["twintag-preview",[[1,"twintag-preview",{"item":[1],"initial":[16],"smoothExtinction":[2,"smooth-extinction"],"extension":[1],"showButtons":[4,"show-buttons"],"previewableItem":[32],"type":[32]}]]],["twintag-auth-callback",[[1,"twintag-auth-callback"]]],["twintag-auth-logout",[[1,"twintag-auth-logout"]]],["twintag-media",[[1,"twintag-media",{"first":[1],"middle":[1],"last":[1]}]]],["twintag-ocr-scanner",[[1,"twintag-ocr-scanner",{"stream":[1040],"mode":[1],"cropX":[2,"crop-x"],"cropY":[2,"crop-y"],"zoom":[514],"devices":[32]},[[2,"recognize","ocrHandler"]]]]],["twintag-offline-actions",[[1,"twintag-offline-actions",{"enableSingleRetry":[4,"enable-single-retry"],"header":[1],"showTimestamp":[4,"show-timestamp"],"showDescription":[4,"show-description"],"closeText":[1,"close-text"],"retryText":[1,"retry-text"],"noPendingActionsText":[1,"no-pending-actions-text"],"pendingOfflineRequests":[32],"processing":[32]},[[8,"offlineRequestsChanged","offlineRequestsChangedHandler"]]]]],["twintag-offline-state",[[1,"twintag-offline-state",{"onlineState":[32],"pendingRequests":[32]},[[8,"onlineChanged","onlineChangedHandler"],[8,"offlineRequestsChanged","offlineRequestsChangedHandler"]]]]],["twintag-offline-support",[[1,"twintag-offline-support",{"autoSync":[4,"auto-sync"],"forceOffline":[4,"force-offline"],"config":[16]}]]],["twintag-qr-scanner",[[1,"twintag-qr-scanner",{"stream":[1040],"mode":[1],"format":[1],"crop":[2],"zoom":[514],"devices":[32]}]]],["twintag-share",[[1,"twintag-share",{"url":[1],"modalTitle":[1,"modal-title"],"modalSubtitle":[1,"modal-subtitle"],"closeBtn":[1,"close-btn"],"copyClipboardBtn":[1,"copy-clipboard-btn"],"open":[1540]},[[0,"keydown","handleKeyDown"]]]]],["twintag-spinner",[[1,"twintag-spinner",{"color":[513],"duration":[2],"name":[1]}]]],["twintag-pdf-viewer",[[0,"twintag-pdf-viewer",{"src":[1],"fileName":[1,"file-name"],"file":[32],"fileURL":[32]}]]]], options);
14
14
  });
15
15
  };
16
16
 
@@ -13,5 +13,5 @@ const patchBrowser = () => {
13
13
  };
14
14
 
15
15
  patchBrowser().then(options => {
16
- return bootstrapLazy([["twintag-preview",[[1,"twintag-preview",{"item":[1],"initial":[16],"smoothExtinction":[2,"smooth-extinction"],"extension":[1],"showButtons":[4,"show-buttons"],"previewableItem":[32],"type":[32]}]]],["twintag-auth-callback",[[1,"twintag-auth-callback"]]],["twintag-auth-logout",[[1,"twintag-auth-logout"]]],["twintag-media",[[1,"twintag-media",{"first":[1],"middle":[1],"last":[1]}]]],["twintag-ocr-scanner",[[1,"twintag-ocr-scanner",{"stream":[1040],"cropX":[2,"crop-x"],"cropY":[2,"crop-y"],"zoom":[514],"devices":[32]},[[2,"recognize","ocrHandler"]]]]],["twintag-offline-actions",[[1,"twintag-offline-actions",{"enableSingleRetry":[4,"enable-single-retry"],"header":[1],"showTimestamp":[4,"show-timestamp"],"showDescription":[4,"show-description"],"closeText":[1,"close-text"],"retryText":[1,"retry-text"],"noPendingActionsText":[1,"no-pending-actions-text"],"pendingOfflineRequests":[32],"processing":[32]},[[8,"offlineRequestsChanged","offlineRequestsChangedHandler"]]]]],["twintag-offline-state",[[1,"twintag-offline-state",{"onlineState":[32],"pendingRequests":[32]},[[8,"onlineChanged","onlineChangedHandler"],[8,"offlineRequestsChanged","offlineRequestsChangedHandler"]]]]],["twintag-offline-support",[[1,"twintag-offline-support",{"autoSync":[4,"auto-sync"],"forceOffline":[4,"force-offline"],"config":[16]}]]],["twintag-qr-scanner",[[1,"twintag-qr-scanner",{"stream":[1040],"mode":[1],"format":[1],"crop":[2],"zoom":[514],"devices":[32]}]]],["twintag-share",[[1,"twintag-share",{"url":[1],"modalTitle":[1,"modal-title"],"modalSubtitle":[1,"modal-subtitle"],"closeBtn":[1,"close-btn"],"copyClipboardBtn":[1,"copy-clipboard-btn"],"open":[1540]},[[0,"keydown","handleKeyDown"]]]]],["twintag-spinner",[[1,"twintag-spinner",{"color":[513],"duration":[2],"name":[1]}]]],["twintag-pdf-viewer",[[0,"twintag-pdf-viewer",{"src":[1],"fileName":[1,"file-name"],"file":[32],"fileURL":[32]}]]]], options);
16
+ return bootstrapLazy([["twintag-preview",[[1,"twintag-preview",{"item":[1],"initial":[16],"smoothExtinction":[2,"smooth-extinction"],"extension":[1],"showButtons":[4,"show-buttons"],"previewableItem":[32],"type":[32]}]]],["twintag-auth-callback",[[1,"twintag-auth-callback"]]],["twintag-auth-logout",[[1,"twintag-auth-logout"]]],["twintag-media",[[1,"twintag-media",{"first":[1],"middle":[1],"last":[1]}]]],["twintag-ocr-scanner",[[1,"twintag-ocr-scanner",{"stream":[1040],"mode":[1],"cropX":[2,"crop-x"],"cropY":[2,"crop-y"],"zoom":[514],"devices":[32]},[[2,"recognize","ocrHandler"]]]]],["twintag-offline-actions",[[1,"twintag-offline-actions",{"enableSingleRetry":[4,"enable-single-retry"],"header":[1],"showTimestamp":[4,"show-timestamp"],"showDescription":[4,"show-description"],"closeText":[1,"close-text"],"retryText":[1,"retry-text"],"noPendingActionsText":[1,"no-pending-actions-text"],"pendingOfflineRequests":[32],"processing":[32]},[[8,"offlineRequestsChanged","offlineRequestsChangedHandler"]]]]],["twintag-offline-state",[[1,"twintag-offline-state",{"onlineState":[32],"pendingRequests":[32]},[[8,"onlineChanged","onlineChangedHandler"],[8,"offlineRequestsChanged","offlineRequestsChangedHandler"]]]]],["twintag-offline-support",[[1,"twintag-offline-support",{"autoSync":[4,"auto-sync"],"forceOffline":[4,"force-offline"],"config":[16]}]]],["twintag-qr-scanner",[[1,"twintag-qr-scanner",{"stream":[1040],"mode":[1],"format":[1],"crop":[2],"zoom":[514],"devices":[32]}]]],["twintag-share",[[1,"twintag-share",{"url":[1],"modalTitle":[1,"modal-title"],"modalSubtitle":[1,"modal-subtitle"],"closeBtn":[1,"close-btn"],"copyClipboardBtn":[1,"copy-clipboard-btn"],"open":[1540]},[[0,"keydown","handleKeyDown"]]]]],["twintag-spinner",[[1,"twintag-spinner",{"color":[513],"duration":[2],"name":[1]}]]],["twintag-pdf-viewer",[[0,"twintag-pdf-viewer",{"src":[1],"fileName":[1,"file-name"],"file":[32],"fileURL":[32]}]]]], options);
17
17
  });
@@ -1897,18 +1897,25 @@ const TwintagOcrScanner = class {
1897
1897
  this.frame = createEvent(this, "frame", 7);
1898
1898
  this.devices = [];
1899
1899
  this.stream = null;
1900
+ this.mode = 'single';
1900
1901
  this.cropX = 1;
1901
1902
  this.cropY = 1;
1902
1903
  this.zoom = 0;
1903
1904
  }
1904
1905
  async ocrHandler() {
1906
+ this.canRecognize.emit(false);
1905
1907
  const { text, frame } = await this.readBarcodeFromCanvas();
1906
1908
  this.symbol.emit({
1907
1909
  text,
1908
1910
  format: 'OCR',
1909
1911
  });
1910
1912
  this.frame.emit(frame);
1911
- this.stopStream();
1913
+ if (this.mode === 'continuous') {
1914
+ this.canRecognize.emit(true);
1915
+ }
1916
+ if (this.mode === 'single') {
1917
+ this.stopStream();
1918
+ }
1912
1919
  }
1913
1920
  async connectedCallback() {
1914
1921
  this.worker = await src.createWorker('eng');
@@ -1934,15 +1941,15 @@ const TwintagOcrScanner = class {
1934
1941
  }
1935
1942
  drawInCanvas() {
1936
1943
  const stage = Math.min(this.video.videoWidth, this.video.videoHeight);
1937
- const xLength = stage * this.cropX;
1938
- const yLength = stage * this.cropY;
1944
+ const width = stage * this.cropX;
1945
+ const height = stage * this.cropY;
1939
1946
  const center = {
1940
1947
  x: this.video.videoWidth / 2,
1941
1948
  y: this.video.videoHeight / 2,
1942
1949
  };
1943
- const sx = center.x - xLength / 2;
1944
- const sy = center.y - yLength / 2;
1945
- this.context.drawImage(this.video, sx, sy, xLength, yLength, 0, 0, stage, stage);
1950
+ const sx = center.x - width / 2;
1951
+ const sy = center.y - height / 2;
1952
+ this.context.drawImage(this.video, sx, sy, width, height, 0, 0, width, height);
1946
1953
  }
1947
1954
  async updateStream(constraints) {
1948
1955
  if (this.stream) {
@@ -2049,8 +2056,10 @@ const TwintagOcrScanner = class {
2049
2056
  onComplete: () => {
2050
2057
  this.streamIsActive.emit(true);
2051
2058
  const stage = Math.min(this.video.videoWidth, this.video.videoHeight);
2052
- this.canvas.width = stage;
2053
- this.canvas.height = stage;
2059
+ const width = stage * this.cropX;
2060
+ const height = stage * this.cropY;
2061
+ this.canvas.width = width;
2062
+ this.canvas.height = height;
2054
2063
  this.canRecognize.emit(true);
2055
2064
  }
2056
2065
  });
@@ -202,7 +202,7 @@ class IndexedDbService {
202
202
  /**
203
203
  * The SDK version.
204
204
  */
205
- const VERSION = '0.2.279-fix-ocr-scanner-update-ca129a0ddafcef2f7b1df1960cc45889702617c1';
205
+ const VERSION = '0.2.279-fix-ocr-scanner-update-ec42ca951c4f16b77ca0afa9f41095303b05aeea';
206
206
 
207
207
  class TwintagErrorValue {
208
208
  }