Add a check so setting src on async image multiple times wont mismatch imageSource

This commit is contained in:
Panayot Cankov
2016-06-09 15:58:39 +03:00
parent 55398d6320
commit f8ee993934
4 changed files with 36 additions and 4 deletions

View File

@@ -97,6 +97,9 @@ export class Image extends view.View implements definition.Image {
var source = new imageSource.ImageSource();
var imageLoaded = () => {
if (value !== this.src) {
return;
}
this.imageSource = source;
this._setValue(Image.isLoadingProperty, false);
}
@@ -143,9 +146,11 @@ export class Image extends view.View implements definition.Image {
else if (value instanceof imageSource.ImageSource) {
// Support binding the imageSource trough the src property
this.imageSource = value;
this._setValue(Image.isLoadingProperty, false);
}
else {
this.imageSource = imageSource.fromNativeSource(value);
this._setValue(Image.isLoadingProperty, false);
}
}
}