mirror of
https://github.com/apache/cordova-plugin-camera.git
synced 2025-01-31 12:42:50 +08:00
Fixed some nit white-space issues, aliased a little more
This commit is contained in:
parent
15f66bf5cd
commit
888a9661fb
@ -89,7 +89,7 @@ function resizeImage(successCallback, errorCallback, file, targetWidth, targetHe
|
|||||||
return fileIO.readBufferAsync(storageFile);
|
return fileIO.readBufferAsync(storageFile);
|
||||||
})
|
})
|
||||||
.then(function(buffer) {
|
.then(function(buffer) {
|
||||||
var strBase64 =encodeToBase64String(buffer);
|
var strBase64 = encodeToBase64String(buffer);
|
||||||
var imageData = "data:" + file.contentType + ";base64," + strBase64;
|
var imageData = "data:" + file.contentType + ";base64," + strBase64;
|
||||||
var image = new Image();
|
var image = new Image();
|
||||||
image.src = imageData;
|
image.src = imageData;
|
||||||
@ -128,7 +128,7 @@ function resizeImage(successCallback, errorCallback, file, targetWidth, targetHe
|
|||||||
// Because of asynchronous method, so let the successCallback be called in it.
|
// Because of asynchronous method, so let the successCallback be called in it.
|
||||||
function resizeImageBase64(successCallback, errorCallback, file, targetWidth, targetHeight) {
|
function resizeImageBase64(successCallback, errorCallback, file, targetWidth, targetHeight) {
|
||||||
fileIO.readBufferAsync(file).done( function(buffer) {
|
fileIO.readBufferAsync(file).done( function(buffer) {
|
||||||
var strBase64 =encodeToBase64String(buffer);
|
var strBase64 = encodeToBase64String(buffer);
|
||||||
var imageData = "data:" + file.contentType + ";base64," + strBase64;
|
var imageData = "data:" + file.contentType + ";base64," + strBase64;
|
||||||
|
|
||||||
var image = new Image();
|
var image = new Image();
|
||||||
@ -318,11 +318,11 @@ function takePictureFromCameraWP(successCallback, errorCallback, args) {
|
|||||||
function cameraPreviewOrientation() {
|
function cameraPreviewOrientation() {
|
||||||
// Rotate the cam since WP8.1 MediaCapture outputs video stream rotated 90° CCW
|
// Rotate the cam since WP8.1 MediaCapture outputs video stream rotated 90° CCW
|
||||||
if (screen.msOrientation === "portrait-primary" || screen.msOrientation === "portrait-secondary") {
|
if (screen.msOrientation === "portrait-primary" || screen.msOrientation === "portrait-secondary") {
|
||||||
capture.setPreviewRotation(Windows.Media.Capture.VideoRotation.clockwise90Degrees);
|
capture.setPreviewRotation(CaptureNS.VideoRotation.clockwise90Degrees);
|
||||||
} else if (screen.msOrientation === "landscape-secondary") {
|
} else if (screen.msOrientation === "landscape-secondary") {
|
||||||
capture.setPreviewRotation(Windows.Media.Capture.VideoRotation.clockwise180Degrees);
|
capture.setPreviewRotation(CaptureNS.VideoRotation.clockwise180Degrees);
|
||||||
} else {
|
} else {
|
||||||
capture.setPreviewRotation(Windows.Media.Capture.VideoRotation.none);
|
capture.setPreviewRotation(CaptureNS.VideoRotation.none);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -348,8 +348,10 @@ function takePictureFromCameraWP(successCallback, errorCallback, args) {
|
|||||||
var startCameraPreview = function () {
|
var startCameraPreview = function () {
|
||||||
// Search for available camera devices
|
// Search for available camera devices
|
||||||
// This is necessary to detect which camera (front or back) we should use
|
// This is necessary to detect which camera (front or back) we should use
|
||||||
var expectedPanel = cameraDirection === 1 ? Windows.Devices.Enumeration.Panel.front : Windows.Devices.Enumeration.Panel.back;
|
var DeviceEnum = Windows.Devices.Enumeration;
|
||||||
Windows.Devices.Enumeration.DeviceInformation.findAllAsync(Windows.Devices.Enumeration.DeviceClass.videoCapture).then(function (devices) {
|
var expectedPanel = cameraDirection === 1 ? DeviceEnum.Panel.front : DeviceEnum.Panel.back;
|
||||||
|
|
||||||
|
DeviceEnum.DeviceInformation.findAllAsync(DeviceEnum.DeviceClass.videoCapture).then(function (devices) {
|
||||||
if (devices.length <= 0) {
|
if (devices.length <= 0) {
|
||||||
destroyCameraPreview();
|
destroyCameraPreview();
|
||||||
errorCallback('Camera not found');
|
errorCallback('Camera not found');
|
||||||
@ -566,6 +568,7 @@ function takePictureFromCameraWindows(successCallback, errorCallback, args) {
|
|||||||
allowCrop = !!args[7],
|
allowCrop = !!args[7],
|
||||||
saveToPhotoAlbum = args[9],
|
saveToPhotoAlbum = args[9],
|
||||||
cameraCaptureUI = new Windows.Media.Capture.CameraCaptureUI();
|
cameraCaptureUI = new Windows.Media.Capture.CameraCaptureUI();
|
||||||
|
|
||||||
cameraCaptureUI.photoSettings.allowCropping = allowCrop;
|
cameraCaptureUI.photoSettings.allowCropping = allowCrop;
|
||||||
|
|
||||||
if (encodingType == Camera.EncodingType.PNG) {
|
if (encodingType == Camera.EncodingType.PNG) {
|
||||||
@ -599,7 +602,6 @@ function takePictureFromCameraWindows(successCallback, errorCallback, args) {
|
|||||||
|
|
||||||
cameraCaptureUI.photoSettings.maxResolution = maxRes;
|
cameraCaptureUI.photoSettings.maxResolution = maxRes;
|
||||||
|
|
||||||
|
|
||||||
cameraCaptureUI.captureFileAsync(Windows.Media.Capture.CameraCaptureUIMode.photo).done(function(picture) {
|
cameraCaptureUI.captureFileAsync(Windows.Media.Capture.CameraCaptureUIMode.photo).done(function(picture) {
|
||||||
if (!picture) {
|
if (!picture) {
|
||||||
errorCallback("User didn't capture a photo.");
|
errorCallback("User didn't capture a photo.");
|
||||||
|
Loading…
Reference in New Issue
Block a user