1
1
import {
2
2
ImageSource , ImageAsset , ImageBase , stretchProperty , imageSourceProperty , srcProperty , tintColorProperty , Color ,
3
- isDataURI , isFileOrResourcePath , RESOURCE_PREFIX
3
+ isDataURI , isFileOrResourcePath , RESOURCE_PREFIX , Length
4
4
} from "./image-common" ;
5
5
import { knownFolders } from "../../file-system" ;
6
6
@@ -43,16 +43,14 @@ function initializeImageLoadedListener() {
43
43
export class Image extends ImageBase {
44
44
nativeViewProtected : org . nativescript . widgets . ImageView ;
45
45
46
- public decodeWidth = 0 ;
47
- public decodeHeight = 0 ;
48
46
public useCache = true ;
49
47
50
48
public createNativeView ( ) {
51
49
if ( ! AndroidImageView ) {
52
50
AndroidImageView = org . nativescript . widgets . ImageView ;
53
51
}
54
52
initializeImageLoadedListener ( ) ;
55
-
53
+
56
54
const imageView = new AndroidImageView ( this . _context ) ;
57
55
const listener = new ImageLoadedListener ( this ) ;
58
56
imageView . setImageLoadedListener ( listener ) ;
@@ -73,7 +71,7 @@ export class Image extends ImageBase {
73
71
74
72
public resetNativeView ( ) : void {
75
73
super . resetNativeView ( ) ;
76
- this . nativeViewProtected . setImageMatrix ( new android . graphics . Matrix ( ) ) ;
74
+ this . nativeViewProtected . setImageMatrix ( new android . graphics . Matrix ( ) ) ;
77
75
}
78
76
79
77
public _createImageSourceFromSrc ( value : string | ImageSource | ImageAsset ) {
@@ -89,8 +87,8 @@ export class Image extends ImageBase {
89
87
90
88
let screen = platform . screen . mainScreen ;
91
89
92
- let decodeWidth = Math . min ( this . decodeWidth , screen . widthPixels ) ;
93
- let decodeHeight = Math . min ( this . decodeHeight , screen . heightPixels ) ;
90
+ let decodeWidth = Math . min ( Length . toDevicePixels ( this . decodeWidth , 0 ) , screen . widthPixels ) ;
91
+ let decodeHeight = Math . min ( Length . toDevicePixels ( this . decodeHeight , 0 ) , screen . heightPixels ) ;
94
92
let keepAspectRatio = this . _calculateKeepAspectRatio ( ) ;
95
93
if ( value instanceof ImageAsset ) {
96
94
if ( value . options ) {
0 commit comments