Dedicated module for image state enum

This commit is contained in:
Tim Schaub
2016-12-27 09:02:02 -07:00
parent 549503bd2e
commit 63a8a5a2cc
13 changed files with 79 additions and 77 deletions

View File

@@ -1,8 +1,8 @@
goog.provide('ol.ImageCanvas');
goog.require('ol');
goog.require('ol.Image');
goog.require('ol.ImageBase');
goog.require('ol.ImageState');
/**
@@ -27,7 +27,7 @@ ol.ImageCanvas = function(extent, resolution, pixelRatio, attributions,
this.loader_ = opt_loader !== undefined ? opt_loader : null;
var state = opt_loader !== undefined ?
ol.Image.State.IDLE : ol.Image.State.LOADED;
ol.ImageState.IDLE : ol.ImageState.LOADED;
ol.ImageBase.call(this, extent, resolution, pixelRatio, state, attributions);
@@ -64,9 +64,9 @@ ol.ImageCanvas.prototype.getError = function() {
ol.ImageCanvas.prototype.handleLoad_ = function(err) {
if (err) {
this.error_ = err;
this.state = ol.Image.State.ERROR;
this.state = ol.ImageState.ERROR;
} else {
this.state = ol.Image.State.LOADED;
this.state = ol.ImageState.LOADED;
}
this.changed();
};
@@ -76,9 +76,9 @@ ol.ImageCanvas.prototype.handleLoad_ = function(err) {
* Trigger drawing on canvas.
*/
ol.ImageCanvas.prototype.load = function() {
if (this.state == ol.Image.State.IDLE) {
if (this.state == ol.ImageState.IDLE) {
ol.DEBUG && console.assert(this.loader_, 'this.loader_ must be set');
this.state = ol.Image.State.LOADING;
this.state = ol.ImageState.LOADING;
this.changed();
this.loader_(this.handleLoad_.bind(this));
}