Avoid busy-waiting while images load

This is to be in conformance with the work done with #184.
This commit is contained in:
Éric Lemoine
2013-02-15 18:02:15 +01:00
parent a3c65978d1
commit 85eec4e9b8
4 changed files with 24 additions and 30 deletions

View File

@@ -69,20 +69,13 @@ ol.renderer.dom.ImageLayer.prototype.renderFrame =
if (!hints[ol.ViewHint.ANIMATING] && !hints[ol.ViewHint.PANNING]) {
var image_ = imageSource.getImage(frameState.extent, viewResolution);
var imageState = image_.getState();
var animate = false;
if (imageState == ol.ImageState.ERROR) {
// pass
} else if (imageState == ol.ImageState.IDLE) {
animate = true;
if (imageState == ol.ImageState.IDLE) {
goog.events.listenOnce(image_, goog.events.EventType.CHANGE,
this.handleImageChange, false, this);
image_.load();
} else if (imageState == ol.ImageState.LOADING) {
animate = true;
} else if (imageState == ol.ImageState.LOADED) {
image = image_;
}
if (animate) {
frameState.animate = true;
}
}
if (!goog.isNull(image)) {