Merge pull request #3202 from NativeScript/zhecheva/image-picker-asset

ImageAsset extends Observable
This commit is contained in:
Maya Zhecheva
2016-11-30 15:15:13 +02:00
committed by GitHub
3 changed files with 9 additions and 4 deletions

View File

@ -1,7 +1,8 @@
import definition = require("image-asset");
import observable = require("data/observable");
import platform = require("platform");
export class ImageAsset implements definition.ImageAsset {
export class ImageAsset extends observable.Observable implements definition.ImageAsset {
private _options: definition.ImageAssetOptions;
private _ios: PHAsset;
private _nativeImage: any;

View File

@ -1,5 +1,7 @@
declare module "image-asset" {
export class ImageAsset {
import { Observable } from "data/observable";
export class ImageAsset extends Observable {
constructor(asset: any);
getImageAsync(callback: (image: any, error: any) => void); //UIImage for iOS and android.graphics.Bitmap for Android
ios: any; //PHAsset
@ -13,4 +15,4 @@ declare module "image-asset" {
height?: number;
keepAspectRatio?: boolean;
}
}
}

View File

@ -122,7 +122,9 @@ export class ImageSource implements definition.ImageSource {
}
public setNativeSource(source: any): boolean {
this.ios = source;
if (source instanceof UIImage) {
this.ios = source;
}
return source != null;
}