mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-18 13:51:27 +08:00
Fix: Setting ImageSource to image.src
This commit is contained in:
@ -21,10 +21,6 @@ export abstract class ImageBase extends View implements ImageDefinition {
|
||||
this.style.tintColor = value;
|
||||
}
|
||||
|
||||
public _setNativeImage(nativeImage: any) {
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
@ -110,7 +106,7 @@ export abstract class ImageBase extends View implements ImageDefinition {
|
||||
export const imageSourceProperty = new Property<ImageBase, ImageSource>({ name: "imageSource" });
|
||||
imageSourceProperty.register(ImageBase);
|
||||
|
||||
export const srcProperty = new Property<ImageBase, any>({ name: "src"});
|
||||
export const srcProperty = new Property<ImageBase, any>({ name: "src" });
|
||||
srcProperty.register(ImageBase);
|
||||
|
||||
export const loadModeProperty = new Property<ImageBase, "sync" | "async">({ name: "loadMode", defaultValue: "sync" });
|
||||
|
@ -67,16 +67,6 @@ export class Image extends ImageBase {
|
||||
this._android = new org.nativescript.widgets.ImageView(this._context);
|
||||
}
|
||||
|
||||
public _setNativeImage(nativeImage: any) {
|
||||
if (!nativeImage) {
|
||||
return;
|
||||
}
|
||||
|
||||
let rotation = nativeImage.rotationAngle ? nativeImage.rotationAngle : 0;
|
||||
this.android.setRotationAngle(rotation);
|
||||
this.android.setImageBitmap(nativeImage.android);
|
||||
}
|
||||
|
||||
public _createImageSourceFromSrc() {
|
||||
let imageView = this._android;
|
||||
this.imageSource = <any>unsetValue;
|
||||
@ -155,7 +145,14 @@ export class Image extends ImageBase {
|
||||
return undefined;
|
||||
}
|
||||
set [imageSourceProperty.native](value: ImageSource) {
|
||||
this._setNativeImage(value ? value.android : null);
|
||||
if (value && value.android) {
|
||||
let rotation = value.rotationAngle ? value.rotationAngle : 0;
|
||||
this.android.setRotationAngle(rotation);
|
||||
this.android.setImageBitmap(value.android);
|
||||
} else {
|
||||
this.android.setRotationAngle(0);
|
||||
this.android.setImageBitmap(null);
|
||||
}
|
||||
}
|
||||
|
||||
get [srcProperty.native](): any {
|
||||
|
Reference in New Issue
Block a user