From 55ba65ac684c59e224d5fd857593962a83dec5c5 Mon Sep 17 00:00:00 2001 From: Alex Muramoto Date: Fri, 19 Aug 2016 06:10:05 -0700 Subject: [PATCH] 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 --- src/plugins/camera-preview.ts | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/src/plugins/camera-preview.ts b/src/plugins/camera-preview.ts index 57f16f9ae..0c45db674 100644 --- a/src/plugins/camera-preview.ts +++ b/src/plugins/camera-preview.ts @@ -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