mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-02-21 00:23:00 +08:00
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:
parent
f3e698f1be
commit
55ba65ac68
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user