mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-03-17 00:51:07 +08:00
refactor(camera):
This commit is contained in:
parent
c122171dd5
commit
8e91f2128f
@ -1,67 +1,67 @@
|
|||||||
import {Plugin, Cordova} from './plugin';
|
import { Cordova, Plugin } from './plugin';
|
||||||
|
|
||||||
|
|
||||||
export interface CameraOptions {
|
export interface CameraOptions {
|
||||||
/** Picture quality in range 0-100. Default is 50 */
|
/** Picture quality in range 0-100. Default is 50 */
|
||||||
quality?: number;
|
quality?: number;
|
||||||
/**
|
/**
|
||||||
* Choose the format of the return value.
|
* Choose the format of the return value.
|
||||||
* Defined in navigator.camera.DestinationType. Default is FILE_URI.
|
* Defined in navigator.camera.DestinationType. Default is FILE_URI.
|
||||||
* DATA_URL : 0, Return image as base64-encoded string
|
* DATA_URL : 0, Return image as base64-encoded string
|
||||||
* FILE_URI : 1, Return image file URI
|
* FILE_URI : 1, Return image file URI
|
||||||
* NATIVE_URI : 2 Return image native URI
|
* NATIVE_URI : 2 Return image native URI
|
||||||
* (e.g., assets-library:// on iOS or content:// on Android)
|
* (e.g., assets-library:// on iOS or content:// on Android)
|
||||||
*/
|
*/
|
||||||
destinationType?: number;
|
destinationType?: number;
|
||||||
/**
|
/**
|
||||||
* Set the source of the picture.
|
* Set the source of the picture.
|
||||||
* Defined in navigator.camera.PictureSourceType. Default is CAMERA.
|
* Defined in navigator.camera.PictureSourceType. Default is CAMERA.
|
||||||
* PHOTOLIBRARY : 0,
|
* PHOTOLIBRARY : 0,
|
||||||
* CAMERA : 1,
|
* CAMERA : 1,
|
||||||
* SAVEDPHOTOALBUM : 2
|
* SAVEDPHOTOALBUM : 2
|
||||||
*/
|
*/
|
||||||
sourceType?: number;
|
sourceType?: number;
|
||||||
/** Allow simple editing of image before selection. */
|
/** Allow simple editing of image before selection. */
|
||||||
allowEdit?: boolean;
|
allowEdit?: boolean;
|
||||||
/**
|
/**
|
||||||
* Choose the returned image file's encoding.
|
* Choose the returned image file's encoding.
|
||||||
* Defined in navigator.camera.EncodingType. Default is JPEG
|
* Defined in navigator.camera.EncodingType. Default is JPEG
|
||||||
* JPEG : 0 Return JPEG encoded image
|
* JPEG : 0 Return JPEG encoded image
|
||||||
* PNG : 1 Return PNG encoded image
|
* PNG : 1 Return PNG encoded image
|
||||||
*/
|
*/
|
||||||
encodingType?: number;
|
encodingType?: number;
|
||||||
/**
|
/**
|
||||||
* Width in pixels to scale image. Must be used with targetHeight.
|
* Width in pixels to scale image. Must be used with targetHeight.
|
||||||
* Aspect ratio remains constant.
|
* Aspect ratio remains constant.
|
||||||
*/
|
*/
|
||||||
targetWidth?: number;
|
targetWidth?: number;
|
||||||
/**
|
/**
|
||||||
* Height in pixels to scale image. Must be used with targetWidth.
|
* Height in pixels to scale image. Must be used with targetWidth.
|
||||||
* Aspect ratio remains constant.
|
* Aspect ratio remains constant.
|
||||||
*/
|
*/
|
||||||
targetHeight?: number;
|
targetHeight?: number;
|
||||||
/**
|
/**
|
||||||
* Set the type of media to select from. Only works when PictureSourceType
|
* Set the type of media to select from. Only works when PictureSourceType
|
||||||
* is PHOTOLIBRARY or SAVEDPHOTOALBUM. Defined in nagivator.camera.MediaType
|
* is PHOTOLIBRARY or SAVEDPHOTOALBUM. Defined in nagivator.camera.MediaType
|
||||||
* PICTURE: 0 allow selection of still pictures only. DEFAULT.
|
* PICTURE: 0 allow selection of still pictures only. DEFAULT.
|
||||||
* Will return format specified via DestinationType
|
* Will return format specified via DestinationType
|
||||||
* VIDEO: 1 allow selection of video only, WILL ALWAYS RETURN FILE_URI
|
* VIDEO: 1 allow selection of video only, WILL ALWAYS RETURN FILE_URI
|
||||||
* ALLMEDIA : 2 allow selection from all media types
|
* ALLMEDIA : 2 allow selection from all media types
|
||||||
*/
|
*/
|
||||||
mediaType?: number;
|
mediaType?: number;
|
||||||
/** Rotate the image to correct for the orientation of the device during capture. */
|
/** Rotate the image to correct for the orientation of the device during capture. */
|
||||||
correctOrientation?: boolean;
|
correctOrientation?: boolean;
|
||||||
/** Save the image to the photo album on the device after capture. */
|
/** Save the image to the photo album on the device after capture. */
|
||||||
saveToPhotoAlbum?: boolean;
|
saveToPhotoAlbum?: boolean;
|
||||||
/**
|
/**
|
||||||
* Choose the camera to use (front- or back-facing).
|
* Choose the camera to use (front- or back-facing).
|
||||||
* Defined in navigator.camera.Direction. Default is BACK.
|
* Defined in navigator.camera.Direction. Default is BACK.
|
||||||
* FRONT: 0
|
* FRONT: 0
|
||||||
* BACK: 1
|
* BACK: 1
|
||||||
*/
|
*/
|
||||||
cameraDirection?: number;
|
cameraDirection?: number;
|
||||||
/** iOS-only options that specify popover location in iPad. Defined in CameraPopoverOptions. */
|
/** iOS-only options that specify popover location in iPad. Defined in CameraPopoverOptions. */
|
||||||
popoverOptions?: CameraPopoverOptions;
|
popoverOptions?: CameraPopoverOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -69,20 +69,20 @@ export interface CameraOptions {
|
|||||||
* of the popover when selecting images from an iPad's library or album.
|
* of the popover when selecting images from an iPad's library or album.
|
||||||
*/
|
*/
|
||||||
export interface CameraPopoverOptions {
|
export interface CameraPopoverOptions {
|
||||||
x: number;
|
x: number;
|
||||||
y: number;
|
y: number;
|
||||||
width: number;
|
width: number;
|
||||||
height: number;
|
height: number;
|
||||||
/**
|
/**
|
||||||
* Direction the arrow on the popover should point. Defined in Camera.PopoverArrowDirection
|
* Direction the arrow on the popover should point. Defined in Camera.PopoverArrowDirection
|
||||||
* Matches iOS UIPopoverArrowDirection constants.
|
* Matches iOS UIPopoverArrowDirection constants.
|
||||||
* ARROW_UP : 1,
|
* ARROW_UP : 1,
|
||||||
* ARROW_DOWN : 2,
|
* ARROW_DOWN : 2,
|
||||||
* ARROW_LEFT : 4,
|
* ARROW_LEFT : 4,
|
||||||
* ARROW_RIGHT : 8,
|
* ARROW_RIGHT : 8,
|
||||||
* ARROW_ANY : 15
|
* ARROW_ANY : 15
|
||||||
*/
|
*/
|
||||||
arrowDir: number;
|
arrowDir: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -95,7 +95,7 @@ export interface CameraPopoverOptions {
|
|||||||
* @usage
|
* @usage
|
||||||
* ```js
|
* ```js
|
||||||
* import {Camera} from 'ionic-native';
|
* import {Camera} from 'ionic-native';
|
||||||
*
|
*
|
||||||
* Camera.getPicture(options).then((imageData) => {
|
* Camera.getPicture(options).then((imageData) => {
|
||||||
* // imageData is either a base64 encoded string or a file URI
|
* // imageData is either a base64 encoded string or a file URI
|
||||||
* // If it's base64:
|
* // If it's base64:
|
||||||
@ -161,7 +161,7 @@ export class Camera {
|
|||||||
/** Allow selection of video only, ONLY RETURNS URL */
|
/** Allow selection of video only, ONLY RETURNS URL */
|
||||||
VIDEO: 1,
|
VIDEO: 1,
|
||||||
/** Allow selection from all media types */
|
/** Allow selection from all media types */
|
||||||
ALLMEDIA : 2
|
ALLMEDIA: 2
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -169,11 +169,11 @@ export class Camera {
|
|||||||
*/
|
*/
|
||||||
static PictureSourceType = {
|
static PictureSourceType = {
|
||||||
/** Choose image from picture library (same as SAVEDPHOTOALBUM for Android) */
|
/** Choose image from picture library (same as SAVEDPHOTOALBUM for Android) */
|
||||||
PHOTOLIBRARY : 0,
|
PHOTOLIBRARY: 0,
|
||||||
/** Take picture from camera */
|
/** Take picture from camera */
|
||||||
CAMERA : 1,
|
CAMERA: 1,
|
||||||
/** Choose image from picture library (same as PHOTOLIBRARY for Android) */
|
/** Choose image from picture library (same as PHOTOLIBRARY for Android) */
|
||||||
SAVEDPHOTOALBUM : 2
|
SAVEDPHOTOALBUM: 2
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -181,11 +181,11 @@ export class Camera {
|
|||||||
* @enum {number}
|
* @enum {number}
|
||||||
*/
|
*/
|
||||||
static PopoverArrowDirection = {
|
static PopoverArrowDirection = {
|
||||||
ARROW_UP : 1,
|
ARROW_UP: 1,
|
||||||
ARROW_DOWN : 2,
|
ARROW_DOWN: 2,
|
||||||
ARROW_LEFT : 4,
|
ARROW_LEFT: 4,
|
||||||
ARROW_RIGHT : 8,
|
ARROW_RIGHT: 8,
|
||||||
ARROW_ANY : 15
|
ARROW_ANY: 15
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user