nativescript-camera
Advanced tools
Comparing version 4.0.3 to 4.1.0
@@ -95,2 +95,13 @@ "use strict"; | ||
} | ||
if (shouldKeepAspectRatio_1) { | ||
var pictureWidth = exif.getAttributeInt(android.media.ExifInterface.TAG_IMAGE_WIDTH, 0); | ||
var pictureHeight = exif.getAttributeInt(android.media.ExifInterface.TAG_IMAGE_LENGTH, 0); | ||
var isPictureLandscape = pictureWidth > pictureHeight; | ||
var areOptionsLandscape = reqWidth_1 > reqHeight_1; | ||
if (isPictureLandscape !== areOptionsLandscape) { | ||
var oldReqWidth = reqWidth_1; | ||
reqWidth_1 = reqHeight_1; | ||
reqHeight_1 = oldReqWidth; | ||
} | ||
} | ||
var asset = new imageAssetModule.ImageAsset(picturePath_1); | ||
@@ -97,0 +108,0 @@ asset.options = { |
@@ -36,3 +36,2 @@ "use strict"; | ||
if (source) { | ||
var image = null; | ||
var imageSource = require("image-source"); | ||
@@ -79,2 +78,13 @@ var imageSourceResult_1 = imageSource.fromNativeSource(source); | ||
UIImagePickerControllerDelegateImpl.prototype.setImageAssetAndCallCallback = function (imageAsset) { | ||
if (this._keepAspectRatio) { | ||
var pictureWidth = imageAsset.nativeImage ? imageAsset.nativeImage.size.width : imageAsset.ios.pixelWidth; | ||
var pictureHeight = imageAsset.nativeImage ? imageAsset.nativeImage.size.height : imageAsset.ios.pixelHeight; | ||
var isPictureLandscape = pictureWidth > pictureHeight; | ||
var areOptionsLandscape = this._width > this._height; | ||
if (isPictureLandscape !== areOptionsLandscape) { | ||
var oldWidth = this._width; | ||
this._width = this._height; | ||
this._height = oldWidth; | ||
} | ||
} | ||
imageAsset.options = { | ||
@@ -136,3 +146,3 @@ width: this._width, | ||
imagePickerController.modalPresentationStyle = 3; | ||
var frame = require("ui/frame"); | ||
var frame = require("tns-core-modules/ui/frame"); | ||
var topMostFrame = frame.topmost(); | ||
@@ -139,0 +149,0 @@ if (topMostFrame) { |
{ | ||
"name": "nativescript-camera", | ||
"version": "4.0.3", | ||
"version": "4.1.0", | ||
"description": "Provides API for using device camera", | ||
@@ -49,10 +49,10 @@ "repository": { | ||
"devDependencies": { | ||
"tns-core-modules": "^4.0.0", | ||
"tns-platform-declarations": "^4.0.0", | ||
"typescript": "~2.7.2", | ||
"tns-core-modules": "^5.0.1", | ||
"tns-platform-declarations": "^5.0.0", | ||
"typescript": "~2.8.2", | ||
"prompt": "^1.0.0", | ||
"rimraf": "^2.5.0", | ||
"tslint": "^5.0.0" | ||
"rimraf": "^2.6.2", | ||
"tslint": "~5.11.0" | ||
}, | ||
"license": "Apache-2.0" | ||
} |
@@ -83,3 +83,3 @@ # NativeScript Camera [![Build Status](https://travis-ci.org/NativeScript/nativescript-camera.svg?branch=master)](https://travis-ci.org/NativeScript/nativescript-camera) | ||
``` JavaScript | ||
var imageModule = require("ui/image"); | ||
var imageModule = require("tns-core-modules/ui/image"); | ||
camera.takePicture() | ||
@@ -95,3 +95,3 @@ .then(function (imageAsset) { | ||
``` TypeScript | ||
import { Image } from "ui/image"; | ||
import { Image } from "tns-core-modules/ui/image"; | ||
camera.takePicture(). | ||
@@ -116,3 +116,3 @@ then((imageAsset) => { | ||
* __keepAspectRatio__: A boolean parameter that indicates if the aspect ratio should be kept. | ||
* __saveToGallery__: A boolean parameter that indicates if the taken photo will be saved in "Photos" for Android and in "Camera Roll" in iOS | ||
* __saveToGallery__: A boolean parameter that indicates if the original taken photo will be saved in "Photos" for Android and in "Camera Roll" in iOS | ||
* __cameraFacing__: Start with either the "front" or "rear" (default) camera of the device. The current implementation doesn't work on all Android devices, in which case it falls back to the default behavior. | ||
@@ -127,3 +127,3 @@ | ||
``` JavaScript | ||
var imageModule = require("ui/image"); | ||
var imageModule = require("tns-core-modules/ui/image"); | ||
@@ -141,3 +141,3 @@ var options = { width: 300, height: 300, keepAspectRatio: false, saveToGallery: true }; | ||
``` TypeScript | ||
import { Image } from "ui/image"; | ||
import { Image } from "tns-core-modules/ui/image"; | ||
@@ -144,0 +144,0 @@ var options = { width: 300, height: 300, keepAspectRatio: false, saveToGallery: true }; |
460
47560
10