easy-js-camera
Advanced tools
Comparing version 2.0.2 to 2.1.0
@@ -102,6 +102,5 @@ 'use strict'; | ||
value: function snap() { | ||
this.canvasElement.width = this.videoElement.scrollWidth; | ||
this.canvasElement.height = this.videoElement.scrollHeight; | ||
this.canvasElement.width = this.videoElement.videoWidth; | ||
this.canvasElement.height = this.videoElement.videoHeight; | ||
var context = this.canvasElement.getContext('2d'); | ||
context.clearRect(0, 0, this.canvasElement.width, this.canvasElement.height); | ||
context.drawImage(this.videoElement, 0, 0, this.canvasElement.width, this.canvasElement.height); | ||
@@ -115,4 +114,4 @@ return this.canvasElement; | ||
}, { | ||
key: 'snapAsBase64', | ||
value: function snapAsBase64() { | ||
key: 'snapAsDataUrl', | ||
value: function snapAsDataUrl() { | ||
this.snap(); | ||
@@ -119,0 +118,0 @@ var data = this.canvasElement.toDataURL('image/png'); |
{ | ||
"name": "easy-js-camera", | ||
"version": "2.0.2", | ||
"version": "2.1.0", | ||
"description": "A package which helps with adding camera support to a web application", | ||
@@ -5,0 +5,0 @@ "main": "lib/Camera.js", |
@@ -47,3 +47,3 @@ # Intro | ||
* **snap:** This method will take a picture and will return the canvasElement so you can extract the picture as whatever format you like. | ||
* **snapAsBase64:** This method will take a picture and will return it as a base64 string. | ||
* **snapAsDataUrl:** This method will take a picture and will return it as a base64 string. | ||
* **snapAsBlob:** This method will take a picture and will return a promise which on resolve will deliver a `blob`. | ||
@@ -50,0 +50,0 @@ * **start:** This method starts the camera and will return a promise for the result of the action. |
@@ -64,6 +64,5 @@ import CameraModel from "./CameraModel"; | ||
snap() { | ||
this.canvasElement.width = this.videoElement.scrollWidth; | ||
this.canvasElement.height = this.videoElement.scrollHeight; | ||
this.canvasElement.width = this.videoElement.videoWidth; | ||
this.canvasElement.height = this.videoElement.videoHeight; | ||
let context = this.canvasElement.getContext('2d'); | ||
context.clearRect(0 , 0, this.canvasElement.width, this.canvasElement.height); | ||
context.drawImage(this.videoElement, 0, 0, this.canvasElement.width, this.canvasElement.height); | ||
@@ -75,3 +74,3 @@ return this.canvasElement; | ||
*/ | ||
snapAsBase64() { | ||
snapAsDataUrl() { | ||
this.snap(); | ||
@@ -78,0 +77,0 @@ let data = this.canvasElement.toDataURL('image/png'); |
15877
331