Dispatch change event on load

This commit is contained in:
Tom Payne
2012-07-15 20:47:37 +02:00
parent ddbe0dccaf
commit dd40b4a758

View File

@@ -66,6 +66,14 @@ ol.Tile = function(tileCoord, src, opt_crossOrigin) {
goog.inherits(ol.Tile, goog.events.EventTarget);
/**
* @protected
*/
ol.Tile.prototype.dispatchChangeEvent = function() {
this.dispatchEvent(goog.events.EventType.CHANGE);
};
/**
* @return {Image} Image.
*/
@@ -89,6 +97,7 @@ ol.Tile.prototype.handleImageError_ = function() {
ol.Tile.prototype.handleImageLoad_ = function() {
this.state_ = ol.TileLoadState.LOADED;
this.unlistenImage_();
this.dispatchChangeEvent();
};
@@ -101,7 +110,6 @@ ol.Tile.prototype.isLoaded = function() {
/**
* @return {EventTarget} Event target.
*/
ol.Tile.prototype.load = function() {
if (this.state_ == ol.TileLoadState.IDLE) {
@@ -115,7 +123,6 @@ ol.Tile.prototype.load = function() {
];
this.image_.src = this.src_;
}
return this.image_;
};