@ericblade/quagga2 1.8.3 → 1.8.4

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.
package/lib/quagga.js CHANGED
@@ -2350,8 +2350,8 @@ function rasterizeAngularSimilarity(patchesFound) {
2350
2350
  };
2351
2351
  patchSize = Object(_common_cv_utils__WEBPACK_IMPORTED_MODULE_2__["calculatePatchSize"])(config.patchSize, size);
2352
2352
  if (false) {}
2353
- inputStream.setWidth(Math.floor(Math.floor(size.x / patchSize.x) * (1 / thisHalfSample) * patchSize.x));
2354
- inputStream.setHeight(Math.floor(Math.floor(size.y / patchSize.y) * (1 / thisHalfSample) * patchSize.y));
2353
+ inputStream.setWidth(Math.max(Math.floor(Math.floor(size.x / patchSize.x) * (1 / thisHalfSample) * patchSize.x), patchSize.x));
2354
+ inputStream.setHeight(Math.max(Math.floor(Math.floor(size.y / patchSize.y) * (1 / thisHalfSample) * patchSize.y), patchSize.y));
2355
2355
  if (inputStream.getWidth() % patchSize.x === 0 && inputStream.getHeight() % patchSize.y === 0) {
2356
2356
  return true;
2357
2357
  }
@@ -11154,8 +11154,12 @@ function initWorker(config, inputStream, cb) {
11154
11154
  } else if (e.data.event === 'processed') {
11155
11155
  workerThread.imageData = new Uint8Array(e.data.imageData);
11156
11156
  workerThread.busy = false;
11157
- // TODO: how to thread publishResult into here?
11158
- // publishResult(e.data.result, workerThread.imageData);
11157
+ // TODO: how to thread publishResult into here? TypeScript says it's not here. https://github.com/ericblade/quagga2/issues/466#issuecomment-1724248080 says it's necessary?
11158
+ // @ts-ignore
11159
+ if (typeof publishResult !== 'undefined') {
11160
+ // @ts-ignore
11161
+ publishResult(e.data.result, workerThread.imageData);
11162
+ }
11159
11163
  } else if (e.data.event === 'error') {
11160
11164
  if (false) {}
11161
11165
  }
@@ -11488,9 +11492,11 @@ var quagga_Quagga = /*#__PURE__*/function () {
11488
11492
  var imageData = arguments.length > 1 ? arguments[1] : undefined;
11489
11493
  var resultToPublish = result;
11490
11494
  if (result && this.context.onUIThread) {
11495
+ var _result$barcodes;
11491
11496
  this.transformResult(result);
11492
11497
  this.addResult(result, imageData);
11493
- resultToPublish = result.barcodes || result;
11498
+ // @ts-ignore
11499
+ resultToPublish = (result === null || result === void 0 ? void 0 : (_result$barcodes = result.barcodes) === null || _result$barcodes === void 0 ? void 0 : _result$barcodes.length) > 0 ? result.barcodes : result;
11494
11500
  }
11495
11501
  events.publish('processed', resultToPublish);
11496
11502
  if (this.hasCodeResult(result)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ericblade/quagga2",
3
- "version": "1.8.3",
3
+ "version": "1.8.4",
4
4
  "description": "An advanced barcode-scanner written in JavaScript",
5
5
  "main": "lib/quagga.js",
6
6
  "types": "type-definitions/quagga.d.ts",
@@ -136,7 +136,9 @@
136
136
  "Sudham Jayanthi <workwithsudham@gmail.com>",
137
137
  "Ben Khoo <khoobks@gmail.com>",
138
138
  "Andy Edinborough <andy@edinborough.org>",
139
- "Claudio Cocciarelli <claudiococciarelli@gmail.com>"
139
+ "Claudio Cocciarelli <claudiococciarelli@gmail.com>",
140
+ "Hadrien Foucault <hadrien.foucault@gmail.com>",
141
+ "ghevge <ghevge@github.com>"
140
142
  ],
141
143
  "license": "MIT",
142
144
  "engines": {