Simplified a bit of JavaScript and TypeScript code.

pull/39/merge
Project Nayuki 6 years ago
parent 4e774437b3
commit 2f77345d24

@ -513,7 +513,7 @@ var qrcodegen = new function() {
var step = (version == 32) ? 26 : var step = (version == 32) ? 26 :
Math.ceil((size - 13) / (numAlign*2 - 2)) * 2; Math.ceil((size - 13) / (numAlign*2 - 2)) * 2;
var result = [6]; var result = [6];
for (var i = 0, pos = size - 7; i < numAlign - 1; i++, pos -= step) for (var pos = size - 7; result.length < numAlign; pos -= step)
result.splice(1, 0, pos); result.splice(1, 0, pos);
return result; return result;
} }

@ -598,7 +598,7 @@ namespace qrcodegen {
let step: int = (this.version == 32) ? 26 : let step: int = (this.version == 32) ? 26 :
Math.ceil((this.size - 13) / (numAlign*2 - 2)) * 2; Math.ceil((this.size - 13) / (numAlign*2 - 2)) * 2;
let result: Array<int> = [6]; let result: Array<int> = [6];
for (let i = 0, pos = this.size - 7; i < numAlign - 1; i++, pos -= step) for (let pos = this.size - 7; result.length < numAlign; pos -= step)
result.splice(1, 0, pos); result.splice(1, 0, pos);
return result; return result;
} }

Loading…
Cancel
Save