node-qrcode-lite/lib/core/finder-pattern.js
Vincenzo Greco 77064f5e5e Refactor/core ()
* Split core lib into multiple files

* Refactor data encoding methods

* Refactor data masking process

* Improve qr code generation process

* Increase minimum required node version to 0.10

* Add linter

* Add tests and tests coverage

* Update travis config to fix compilation issues

* Add examples folder

* Add missing license tag in package.json

* Update build script and add sourcemap support

* Publish only strictly needed files on npm

* Update readme
2016-12-16 23:45:08 +01:00

22 lines
593 B
JavaScript

var getSymbolSize = require('./utils').getSymbolSize
var FINDER_PATTERN_SIZE = 7
/**
* Returns an array containing the positions of each finder pattern.
* Each array's element represent the top-left point of the pattern as (x, y) coordinates
*
* @param {Number} version QR Code version
* @return {Array} Array of coordinates
*/
exports.getPositions = function getPositions (version) {
var size = getSymbolSize(version)
return [
// top-left
[0, 0],
// top-right
[size - FINDER_PATTERN_SIZE, 0],
// bottom-left
[0, size - FINDER_PATTERN_SIZE]
]
}