Skip to content

Commit 90f1810

Browse files
author
Ciro S. Costa
committed
bump version, code styling
1 parent e39df7f commit 90f1810

6 files changed

Lines changed: 55 additions & 44 deletions

File tree

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "qcode-decoder",
33
"main": "build/main.min.js",
44
"description": "Decodes QRCode in the browser and node",
5-
"version": "0.0.4",
5+
"version": "0.0.5",
66
"homepage": "https://github.com/cirocosta/qcode-decoder",
77
"authors": [
88
"Ciro S. Costa <ciro.costa@usp.br>"

build/qcode-decoder.js

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3837,16 +3837,19 @@ function QRCodeDecoder () {
38373837
}
38383838

38393839
/**
3840-
* Prepares the canvas element (which will receive the image from the
3841-
* camera and provide what the algorithm needs for checking for a
3840+
* Prepares the canvas element (which will
3841+
* receive the image from the camera and provide
3842+
* what the algorithm needs for checking for a
38423843
* QRCode and then decoding it.)
3843-
* @param {DOMElement} canvasElem the canvas element
3844-
* @param {number} width The width that the canvas element
3845-
* should have
3846-
* @param {number} height The height that the canvas element
3847-
* should have
3848-
* @return {DOMElement} the canvas after the resize if
3849-
* width and height provided.
3844+
* @param {DOMElement} canvasElem the canvas
3845+
* element
3846+
* @param {number} width The width that
3847+
* the canvas element should have
3848+
* @param {number} height The height that
3849+
* the canvas element should have
3850+
* @return {DOMElement} the canvas
3851+
* after the resize if width and height
3852+
* provided.
38503853
*/
38513854
QRCodeDecoder.prototype.prepareCanvas = function (canvasElem, width, height) {
38523855
if (width && height) {
@@ -3864,16 +3867,18 @@ QRCodeDecoder.prototype.prepareCanvas = function (canvasElem, width, height) {
38643867

38653868
QRCodeDecoder.prototype._captureToCanvas = function () {
38663869
var scope = this;
3870+
var cWidth = this.canvasElem.width;
3871+
var cHeight = this.canvasElem.height;
38673872

38683873
if (this.tmrCapture) {
38693874
clearTimeout(this.tmrCapture);
38703875
}
38713876

38723877
var gCtx = this.canvasElem.getContext("2d");
3873-
gCtx.clearRect(0, 0, this.canvasElem.width, this.canvasElem.height);
3878+
gCtx.clearRect(0, 0, cWidth, cHeight);
38743879

38753880
try{
3876-
gCtx.drawImage(this.videoElem,0,0,this.canvasElem.width,this.canvasElem.height);
3881+
gCtx.drawImage(this.videoElem, 0, 0,cWidth,cHeight);
38773882
try{
38783883
qrcode.decode();
38793884
}
@@ -3893,7 +3898,8 @@ QRCodeDecoder.prototype._captureToCanvas = function () {
38933898
};
38943899

38953900
/**
3896-
* Verifies if the user has getUserMedia enabled in the browser.
3901+
* Verifies if the user has getUserMedia enabled
3902+
* in the browser.
38973903
*/
38983904
QRCodeDecoder.prototype.hasGetUserMedia = function () {
38993905
return !!(navigator.getUserMedia || navigator.webkitGetUserMedia ||
@@ -3910,10 +3916,12 @@ QRCodeDecoder.prototype.isCanvasSupported = function () {
39103916
};
39113917

39123918
/**
3913-
* Prepares the video element for receiving camera's input.
3914-
* @param {DOMElement} videoElem <video> dom element
3915-
* @param {Function} errcb callback function to be called in case
3916-
* of error
3919+
* Prepares the video element for receiving
3920+
* camera's input.
3921+
* @param {DOMElement} videoElem <video> dom
3922+
* element
3923+
* @param {Function} errcb callback
3924+
* function to be called in case of error
39173925
*/
39183926
QRCodeDecoder.prototype.prepareVideo = function(videoElem, errcb) {
39193927
var scope = this;
@@ -3942,7 +3950,8 @@ QRCodeDecoder.prototype.prepareVideo = function(videoElem, errcb) {
39423950
};
39433951

39443952
/**
3945-
* Releases a video stream that was being captured by prepareToVideo
3953+
* Releases a video stream that was being
3954+
* captured by prepareToVideo
39463955
*/
39473956
QRCodeDecoder.prototype.releaseVideo = function() {
39483957
this.stream.stop();

build/qcode-decoder.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gulpfile.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,6 @@ gulp.task('build', ['build-vendor'], function() {
4646
.pipe(gulp.dest('build'));
4747
});
4848

49-
// /**
50-
// * Hinting and testing
51-
// */
52-
5349
gulp.task('hint', function () {
5450
return gulp.src('src/*.js')
5551
.pipe(jshint())

package.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "qcode-decoder",
3-
"version": "0.0.4",
3+
"version": "0.0.5",
44
"description": "Decodes QRCode in the Browser and Node",
55
"main": "index.js",
66
"directories": {
@@ -11,9 +11,6 @@
1111
"type": "git",
1212
"url": "https://github.com/cirocosta/qcode-decoder.git"
1313
},
14-
"scripts": {
15-
"test": "gulp test"
16-
},
1714
"author": "Ciro S. Costa <ciro9758@gmail.com> (http://cirocosta.github.io/)",
1815
"license": "MIT",
1916
"bugs": {

src/qcode-decoder.js

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,19 @@ function QRCodeDecoder () {
77
}
88

99
/**
10-
* Prepares the canvas element (which will receive the image from the
11-
* camera and provide what the algorithm needs for checking for a
10+
* Prepares the canvas element (which will
11+
* receive the image from the camera and provide
12+
* what the algorithm needs for checking for a
1213
* QRCode and then decoding it.)
13-
* @param {DOMElement} canvasElem the canvas element
14-
* @param {number} width The width that the canvas element
15-
* should have
16-
* @param {number} height The height that the canvas element
17-
* should have
18-
* @return {DOMElement} the canvas after the resize if
19-
* width and height provided.
14+
* @param {DOMElement} canvasElem the canvas
15+
* element
16+
* @param {number} width The width that
17+
* the canvas element should have
18+
* @param {number} height The height that
19+
* the canvas element should have
20+
* @return {DOMElement} the canvas
21+
* after the resize if width and height
22+
* provided.
2023
*/
2124
QRCodeDecoder.prototype.prepareCanvas = function (canvasElem, width, height) {
2225
if (width && height) {
@@ -34,16 +37,18 @@ QRCodeDecoder.prototype.prepareCanvas = function (canvasElem, width, height) {
3437

3538
QRCodeDecoder.prototype._captureToCanvas = function () {
3639
var scope = this;
40+
var cWidth = this.canvasElem.width;
41+
var cHeight = this.canvasElem.height;
3742

3843
if (this.tmrCapture) {
3944
clearTimeout(this.tmrCapture);
4045
}
4146

4247
var gCtx = this.canvasElem.getContext("2d");
43-
gCtx.clearRect(0, 0, this.canvasElem.width, this.canvasElem.height);
48+
gCtx.clearRect(0, 0, cWidth, cHeight);
4449

4550
try{
46-
gCtx.drawImage(this.videoElem,0,0,this.canvasElem.width,this.canvasElem.height);
51+
gCtx.drawImage(this.videoElem, 0, 0,cWidth,cHeight);
4752
try{
4853
qrcode.decode();
4954
}
@@ -63,7 +68,8 @@ QRCodeDecoder.prototype._captureToCanvas = function () {
6368
};
6469

6570
/**
66-
* Verifies if the user has getUserMedia enabled in the browser.
71+
* Verifies if the user has getUserMedia enabled
72+
* in the browser.
6773
*/
6874
QRCodeDecoder.prototype.hasGetUserMedia = function () {
6975
return !!(navigator.getUserMedia || navigator.webkitGetUserMedia ||
@@ -80,10 +86,12 @@ QRCodeDecoder.prototype.isCanvasSupported = function () {
8086
};
8187

8288
/**
83-
* Prepares the video element for receiving camera's input.
84-
* @param {DOMElement} videoElem <video> dom element
85-
* @param {Function} errcb callback function to be called in case
86-
* of error
89+
* Prepares the video element for receiving
90+
* camera's input.
91+
* @param {DOMElement} videoElem <video> dom
92+
* element
93+
* @param {Function} errcb callback
94+
* function to be called in case of error
8795
*/
8896
QRCodeDecoder.prototype.prepareVideo = function(videoElem, errcb) {
8997
var scope = this;
@@ -112,7 +120,8 @@ QRCodeDecoder.prototype.prepareVideo = function(videoElem, errcb) {
112120
};
113121

114122
/**
115-
* Releases a video stream that was being captured by prepareToVideo
123+
* Releases a video stream that was being
124+
* captured by prepareToVideo
116125
*/
117126
QRCodeDecoder.prototype.releaseVideo = function() {
118127
this.stream.stop();

0 commit comments

Comments
 (0)