nativescript-imagepicker
Advanced tools
Comparing version 3.0.7 to 4.0.0
@@ -18,3 +18,2 @@ "use strict"; | ||
_this._uri = uri; | ||
_this._thumbRequested = false; | ||
return _this; | ||
@@ -51,12 +50,2 @@ } | ||
}; | ||
Object.defineProperty(SelectedAsset.prototype, "thumb", { | ||
get: function () { | ||
if (!this._thumbRequested) { | ||
this.decodeThumbUri(); | ||
} | ||
return this._thumb; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(SelectedAsset.prototype, "thumbAsset", { | ||
@@ -170,10 +159,2 @@ get: function () { | ||
}; | ||
SelectedAsset.prototype.decodeThumbUri = function () { | ||
var REQUIRED_SIZE = { | ||
maxWidth: 100, | ||
maxHeight: 100 | ||
}; | ||
this._thumb = this.decodeUri(this._uri, REQUIRED_SIZE); | ||
this.notifyPropertyChange("thumb", this._thumb); | ||
}; | ||
SelectedAsset.prototype.decodeThumbAssetUri = function () { | ||
@@ -180,0 +161,0 @@ var REQUIRED_SIZE = { |
@@ -150,13 +150,2 @@ "use strict"; | ||
}); | ||
Object.defineProperty(Album.prototype, "thumb", { | ||
get: function () { | ||
return this._thumb; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Album.prototype.setThumb = function (value) { | ||
this._thumb = value; | ||
this.notifyPropertyChange("thumb", value); | ||
}; | ||
Object.defineProperty(Album.prototype, "thumbAsset", { | ||
@@ -181,9 +170,2 @@ get: function () { | ||
} | ||
Object.defineProperty(SelectedAsset.prototype, "thumb", { | ||
get: function () { | ||
return null; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(SelectedAsset.prototype, "uri", { | ||
@@ -227,13 +209,2 @@ get: function () { | ||
}); | ||
Object.defineProperty(Asset.prototype, "thumb", { | ||
get: function () { | ||
if (!this._thumbRequested) { | ||
this._thumbRequested = true; | ||
this.onThumbRequest(); | ||
} | ||
return this._thumb; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(Asset.prototype, "selected", { | ||
@@ -275,8 +246,2 @@ get: function () { | ||
}; | ||
Asset.prototype.setThumb = function (value) { | ||
this._thumb = value; | ||
this.notifyPropertyChange("thumb", this._thumb); | ||
}; | ||
Asset.prototype.onThumbRequest = function () { | ||
}; | ||
return Asset; | ||
@@ -293,2 +258,3 @@ }(SelectedAsset)); | ||
_this._thumbRequestOptions.deliveryMode = 0; | ||
_this._thumbRequestOptions.networkAccessAllowed = true; | ||
_this._thumbRequestOptions.normalizedCropRect = CGRectMake(0, 0, 1, 1); | ||
@@ -336,9 +302,2 @@ _this._thumbRequestSize = CGSizeMake(80, 80); | ||
}; | ||
ImagePickerPH.prototype.createPHImageThumb = function (target, asset) { | ||
PHImageManager.defaultManager().requestImageForAssetTargetSizeContentModeOptionsResultHandler(asset, this._thumbRequestSize, 1, this._thumbRequestOptions, function (target, uiImage, info) { | ||
var imageSource = new image_source.ImageSource(); | ||
imageSource.setNativeSource(uiImage); | ||
target.setThumb(imageSource); | ||
}.bind(this, target)); | ||
}; | ||
ImagePickerPH.prototype.createPHImageThumbAsset = function (target, asset) { | ||
@@ -359,2 +318,3 @@ PHImageManager.defaultManager().requestImageForAssetTargetSizeContentModeOptionsResultHandler(asset, this._thumbRequestSize, 1, this._thumbRequestOptions, function (target, uiImage, info) { | ||
var resizeMode = PHImageRequestOptions.alloc().init(); | ||
var aspectRatio = (options && options.aspectRatio && options.aspectRatio === 'fill') ? 1 : 0; | ||
resizeMode.resizeMode = 2; | ||
@@ -364,3 +324,3 @@ resizeMode.synchronous = false; | ||
resizeMode.normalizedCropRect = CGRectMake(0, 0, 1, 1); | ||
PHImageManager.defaultManager().requestImageForAssetTargetSizeContentModeOptionsResultHandler(image, size, 1, resizeMode, function (createdImage, data) { | ||
PHImageManager.defaultManager().requestImageForAssetTargetSizeContentModeOptionsResultHandler(image, size, aspectRatio, resizeMode, function (createdImage, data) { | ||
if (createdImage) { | ||
@@ -420,3 +380,2 @@ var imageSource = new image_source.ImageSource(); | ||
this._setThumb = true; | ||
imagePicker.createPHImageThumb(this, asset); | ||
imagePicker.createPHImageThumbAsset(this, asset); | ||
@@ -448,6 +407,2 @@ } | ||
}); | ||
AssetPH.prototype.onThumbRequest = function () { | ||
_super.prototype.onThumbRequest.call(this); | ||
this.album.imagePicker.createPHImageThumb(this, this._phAsset); | ||
}; | ||
Object.defineProperty(AssetPH.prototype, "uri", { | ||
@@ -454,0 +409,0 @@ get: function () { |
@@ -15,13 +15,11 @@ import observable = require("tns-core-modules/data/observable"); | ||
maxHeight?: number; | ||
} | ||
export class SelectedAsset extends imageAssetModule.ImageAsset { | ||
/** | ||
* [Deprecated. SelectedAsset will be used directly as a source for the thumb image] | ||
* A 100x100 pixels thumb of the selected image. | ||
* This property will be initialized on demand. The first access will return undefined or null. | ||
* It will trigger an async load and when the thumb is obtained, a property changed notification will occur. | ||
* iOS only. The image aspect ratio. Default value: fit. | ||
*/ | ||
thumb: imagesource.ImageSource; | ||
aspectRatio?: "fill" | "fit"; | ||
} | ||
export class SelectedAsset extends imageAssetModule.ImageAsset { | ||
/** | ||
@@ -28,0 +26,0 @@ * URI that identifies the image asset. |
{ | ||
"name": "nativescript-imagepicker", | ||
"version": "3.0.7", | ||
"version": "4.0.0", | ||
"description": "A plugin for the NativeScript framework implementing multiple image picker", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -105,4 +105,14 @@ # NativeScript Image Picker ![apple](https://cdn3.iconfinder.com/data/icons/picons-social/57/16-apple-32.png) ![android](https://cdn4.iconfinder.com/data/icons/logos-3/228/android-32.png) | ||
### Image properties | ||
Once image is picked some options can be applied to it before it is used: | ||
| Option | Default | Description | | ||
| --- | --- | --- | | ||
| maxWidth | null | Image max width | | ||
| maxHeight | null | Image max height | | ||
| aspectRatio | fit | iOS only. Possible values are `fit` and `fill`. [Read more](https://developer.apple.com/documentation/photos/phimagecontentmode) | | ||
## License | ||
2015, Telerik AD |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
117
52424
1009
1