mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
Add isIOS, isAndroid in platform, and fast ts watcher and transpiler
Image should not requestLayout when sized with 'exactly' spec Update image tests Tests will run in ios only
This commit is contained in:
@@ -36,6 +36,7 @@ function onImageSourcePropertyChanged(data: dependencyObservable.PropertyChangeD
|
||||
|
||||
export class Image extends imageCommon.Image {
|
||||
private _ios: UIImageView;
|
||||
private _imageSourceAffectsLayout: boolean = true;
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
@@ -54,7 +55,7 @@ export class Image extends imageCommon.Image {
|
||||
public _setNativeImage(nativeImage: any) {
|
||||
this.ios.image = nativeImage;
|
||||
|
||||
if (isNaN(this.width) || isNaN(this.height)) {
|
||||
if (this._imageSourceAffectsLayout) {
|
||||
this.requestLayout();
|
||||
}
|
||||
}
|
||||
@@ -77,7 +78,9 @@ export class Image extends imageCommon.Image {
|
||||
|
||||
var finiteWidth: boolean = widthMode !== utils.layout.UNSPECIFIED;
|
||||
var finiteHeight: boolean = heightMode !== utils.layout.UNSPECIFIED;
|
||||
|
||||
|
||||
this._imageSourceAffectsLayout = widthMode !== utils.layout.EXACTLY || heightMode !== utils.layout.EXACTLY;
|
||||
|
||||
if (nativeWidth !== 0 && nativeHeight !== 0 && (finiteWidth || finiteHeight)) {
|
||||
var scale = Image.computeScaleFactor(width, height, finiteWidth, finiteHeight, nativeWidth, nativeHeight, this.stretch);
|
||||
var resultW = Math.floor(nativeWidth * scale.width);
|
||||
|
||||
Reference in New Issue
Block a user