Skip to content
This repository has been archived by the owner on Apr 5, 2022. It is now read-only.

Commit

Permalink
Add props parameter aspectRatio
Browse files Browse the repository at this point in the history
  • Loading branch information
sin-tanaka committed Apr 12, 2019
1 parent 4e5b9ac commit 8183db0
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 3 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,5 +116,15 @@ default:
}
```

### aspectRatio: Object {min: Number, max: Number}

Set aspect ratio. it affects <video> aspect ratio.

default:

```js
{
min: 1,
max: 2,
}
```
9 changes: 8 additions & 1 deletion examples/src/App.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
<template>
<div>
<v-quagga :onDetected="logIt" :readerSize="readerSize" :readerType="'ean_reader'"></v-quagga>
<h1>Barcode Reader</h1>
<v-quagga
:onDetected="logIt"
:readerSize="readerSize"
:readerType="'ean_reader'"
:aspectRatio="aspectRatio"
></v-quagga>
</div>
</template>

Expand All @@ -13,6 +19,7 @@
width: 640,
height: 480
},
aspectRatio: { min: 1, max: 2 },
detecteds: []
}
},
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "A Vue.js component, accessing the device camera and allowing users to read barcodes, within the browser",
"main": "dist/vue-quagga.js",
"module": "src/index.js",
"version": "1.0.9",
"version": "1.0.10",
"author": "Shintaro Tanaka <genaxy@gmail.com>",
"license": "MIT",
"scripts": {
Expand Down
10 changes: 9 additions & 1 deletion src/Scanner.vue
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,14 @@ export default {
validator: o =>
typeof o.width === 'number' && typeof o.height === 'number',
},
aspectRatio: {
type: Object,
default: () => ({
min: 1,
max: 2,
}),
validator: o => typeof o.min === 'number' && typeof o.max === 'number',
},
},
data: function() {
return {
Expand Down Expand Up @@ -103,7 +111,7 @@ export default {
mounted: function() {
Quagga.init(this.quaggaState, function(err) {
if (err) {
return console.log(err);
return console.error(err);
}
Quagga.start();
});
Expand Down

0 comments on commit 8183db0

Please sign in to comment.