Skip to content

Commit

Permalink
fix(camera-preview): changes implementation to match Cordova plugin (#…
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
amuramoto authored and ihadeed committed Aug 19, 2016
1 parent f3e698f commit 55ba65a
Showing 1 changed file with 11 additions and 17 deletions.
28 changes: 11 additions & 17 deletions src/plugins/camera-preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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.
Expand All @@ -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
Expand Down

0 comments on commit 55ba65a

Please sign in to comment.