fix(camera-preview): changes implementation to match Cordova plugin (#441)

* Removes preview settings from options obj and creates proper rect interface

* Changes startCamera() signature to match plugin

* Adds alpha to function signature

* Removes CameraPreviewOptions and CameraPreviewSize interfaces that don't match plugin

* Adds back CameraPreviewSize interface - oops

* Updates docs for startCamera()

* Changes CameraPreviewSize interface to Size to match plugin

* Adds docs for takePicture

* Reverts change to signature of setOnPictureTakenHandler

* Adds CameraPreview prefix to interfaces
This commit is contained in:
Alex Muramoto 2016-08-19 06:10:05 -07:00 committed by Ibrahim Hadeed
parent f3e698f1be
commit 55ba65ac68

View File

@ -2,25 +2,11 @@ import { Cordova, Plugin } from './plugin';
import { Observable } from 'rxjs/Observable';
export interface CameraPreviewOptions {
export interface CameraPreviewRect {
x: number;
y: number;
width: number;
height: number;
/**
* Choose the camera to use (front- or back-facing).
* 'front' for front camera
* 'rear' for rear camera
*/
camera: string;
/** Take photo on tap */
tapPhoto: boolean;
/** */
previewDrag: boolean;
/** */
toBack: boolean;
/** Alpha use when toBack is set to true */
alpha: number;
}
export interface CameraPreviewSize {
@ -46,12 +32,19 @@ export class CameraPreview {
/**
* Starts the camera preview instance.
* @param {CameraPreviewOptions} options for the preview
* @param {CameraPreviewRect} position and size of the preview window - {x: number, y: number, width: number, height: number}
* @param {string} which camera to use - 'front' | 'back'
* @param {boolean} enable tap to take picture
* @param {boolean} enable preview box drag across the screen
* @param {boolean} send preview box to the back of the webview
* @param {number} alpha of the preview box
*/
@Cordova({
sync: true
})
static startCamera(options: CameraPreviewOptions): void { };
static startCamera(rect: CameraPreviewRect, defaultCamera: string, tapEnabled: boolean, dragEnabled: boolean, toBack: boolean, alpha: number): void {
};
/**
* Stops the camera preview instance.
@ -63,6 +56,7 @@ export class CameraPreview {
/**
* Take the picture, the parameter size is optional
* @param {CameraPreviewSize} optional - size of the picture to take
*/
@Cordova({
sync: true