Skip to content

Commit

Permalink
cozmo#148 Fix onlyInvert
Browse files Browse the repository at this point in the history
  • Loading branch information
cc-ebay committed Dec 30, 2019
1 parent 1ec3427 commit 44d65ba
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dist/jsQR.js
Original file line number Diff line number Diff line change
Expand Up @@ -369,8 +369,8 @@ function jsQR(data, width, height, providedOptions) {
var options = Object.create(null);
mergeObject(options, defaultOptions);
mergeObject(options, providedOptions);
var shouldInvert = options.inversionAttempts === "attemptBoth" || options.inversionAttempts === "invertFirst";
var tryInvertedFirst = options.inversionAttempts === "onlyInvert" || options.inversionAttempts === "invertFirst";
var shouldInvert = options.inversionAttempts === "attemptBoth" || tryInvertedFirst;
var _a = binarizer_1.binarize(data, width, height, shouldInvert, options.canOverwriteImage), binarized = _a.binarized, inverted = _a.inverted;
var result = scan(tryInvertedFirst ? inverted : binarized);
if (!result && (options.inversionAttempts === "attemptBoth" || options.inversionAttempts === "invertFirst")) {
Expand Down
2 changes: 1 addition & 1 deletion docs/jsQR.js
Original file line number Diff line number Diff line change
Expand Up @@ -369,8 +369,8 @@ function jsQR(data, width, height, providedOptions) {
var options = Object.create(null);
mergeObject(options, defaultOptions);
mergeObject(options, providedOptions);
var shouldInvert = options.inversionAttempts === "attemptBoth" || options.inversionAttempts === "invertFirst";
var tryInvertedFirst = options.inversionAttempts === "onlyInvert" || options.inversionAttempts === "invertFirst";
var shouldInvert = options.inversionAttempts === "attemptBoth" || tryInvertedFirst;
var _a = binarizer_1.binarize(data, width, height, shouldInvert, options.canOverwriteImage), binarized = _a.binarized, inverted = _a.inverted;
var result = scan(tryInvertedFirst ? inverted : binarized);
if (!result && (options.inversionAttempts === "attemptBoth" || options.inversionAttempts === "invertFirst")) {
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ function jsQR(data: Uint8ClampedArray, width: number, height: number, providedOp
mergeObject(options, defaultOptions);
mergeObject(options, providedOptions);

const shouldInvert = options.inversionAttempts === "attemptBoth" || options.inversionAttempts === "invertFirst";
const tryInvertedFirst = options.inversionAttempts === "onlyInvert" || options.inversionAttempts === "invertFirst";
const shouldInvert = options.inversionAttempts === "attemptBoth" || tryInvertedFirst;
const {binarized, inverted} = binarize(data, width, height, shouldInvert, options.canOverwriteImage);
let result = scan(tryInvertedFirst ? inverted : binarized);
if (!result && (options.inversionAttempts === "attemptBoth" || options.inversionAttempts === "invertFirst")) {
Expand Down

0 comments on commit 44d65ba

Please sign in to comment.