Transformed
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
goog.provide('ol.Image');
|
||||
|
||||
goog.require('ol');
|
||||
goog.require('ol.ImageBase');
|
||||
goog.require('ol.ImageState');
|
||||
goog.require('ol.events');
|
||||
goog.require('ol.events.EventType');
|
||||
goog.require('ol.extent');
|
||||
|
||||
/**
|
||||
* @module ol/Image
|
||||
*/
|
||||
import _ol_ from './index.js';
|
||||
import _ol_ImageBase_ from './ImageBase.js';
|
||||
import _ol_ImageState_ from './ImageState.js';
|
||||
import _ol_events_ from './events.js';
|
||||
import _ol_events_EventType_ from './events/EventType.js';
|
||||
import _ol_extent_ from './extent.js';
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
@@ -18,9 +18,9 @@ goog.require('ol.extent');
|
||||
* @param {?string} crossOrigin Cross origin.
|
||||
* @param {ol.ImageLoadFunctionType} imageLoadFunction Image load function.
|
||||
*/
|
||||
ol.Image = function(extent, resolution, pixelRatio, src, crossOrigin, imageLoadFunction) {
|
||||
var _ol_Image_ = function(extent, resolution, pixelRatio, src, crossOrigin, imageLoadFunction) {
|
||||
|
||||
ol.ImageBase.call(this, extent, resolution, pixelRatio, ol.ImageState.IDLE);
|
||||
_ol_ImageBase_.call(this, extent, resolution, pixelRatio, _ol_ImageState_.IDLE);
|
||||
|
||||
/**
|
||||
* @private
|
||||
@@ -47,7 +47,7 @@ ol.Image = function(extent, resolution, pixelRatio, src, crossOrigin, imageLoadF
|
||||
* @protected
|
||||
* @type {ol.ImageState}
|
||||
*/
|
||||
this.state = ol.ImageState.IDLE;
|
||||
this.state = _ol_ImageState_.IDLE;
|
||||
|
||||
/**
|
||||
* @private
|
||||
@@ -56,14 +56,15 @@ ol.Image = function(extent, resolution, pixelRatio, src, crossOrigin, imageLoadF
|
||||
this.imageLoadFunction_ = imageLoadFunction;
|
||||
|
||||
};
|
||||
ol.inherits(ol.Image, ol.ImageBase);
|
||||
|
||||
_ol_.inherits(_ol_Image_, _ol_ImageBase_);
|
||||
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @api
|
||||
*/
|
||||
ol.Image.prototype.getImage = function() {
|
||||
_ol_Image_.prototype.getImage = function() {
|
||||
return this.image_;
|
||||
};
|
||||
|
||||
@@ -73,8 +74,8 @@ ol.Image.prototype.getImage = function() {
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
ol.Image.prototype.handleImageError_ = function() {
|
||||
this.state = ol.ImageState.ERROR;
|
||||
_ol_Image_.prototype.handleImageError_ = function() {
|
||||
this.state = _ol_ImageState_.ERROR;
|
||||
this.unlistenImage_();
|
||||
this.changed();
|
||||
};
|
||||
@@ -85,11 +86,11 @@ ol.Image.prototype.handleImageError_ = function() {
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
ol.Image.prototype.handleImageLoad_ = function() {
|
||||
_ol_Image_.prototype.handleImageLoad_ = function() {
|
||||
if (this.resolution === undefined) {
|
||||
this.resolution = ol.extent.getHeight(this.extent) / this.image_.height;
|
||||
this.resolution = _ol_extent_.getHeight(this.extent) / this.image_.height;
|
||||
}
|
||||
this.state = ol.ImageState.LOADED;
|
||||
this.state = _ol_ImageState_.LOADED;
|
||||
this.unlistenImage_();
|
||||
this.changed();
|
||||
};
|
||||
@@ -102,14 +103,14 @@ ol.Image.prototype.handleImageLoad_ = function() {
|
||||
* @override
|
||||
* @api
|
||||
*/
|
||||
ol.Image.prototype.load = function() {
|
||||
if (this.state == ol.ImageState.IDLE || this.state == ol.ImageState.ERROR) {
|
||||
this.state = ol.ImageState.LOADING;
|
||||
_ol_Image_.prototype.load = function() {
|
||||
if (this.state == _ol_ImageState_.IDLE || this.state == _ol_ImageState_.ERROR) {
|
||||
this.state = _ol_ImageState_.LOADING;
|
||||
this.changed();
|
||||
this.imageListenerKeys_ = [
|
||||
ol.events.listenOnce(this.image_, ol.events.EventType.ERROR,
|
||||
_ol_events_.listenOnce(this.image_, _ol_events_EventType_.ERROR,
|
||||
this.handleImageError_, this),
|
||||
ol.events.listenOnce(this.image_, ol.events.EventType.LOAD,
|
||||
_ol_events_.listenOnce(this.image_, _ol_events_EventType_.LOAD,
|
||||
this.handleImageLoad_, this)
|
||||
];
|
||||
this.imageLoadFunction_(this, this.src_);
|
||||
@@ -120,7 +121,7 @@ ol.Image.prototype.load = function() {
|
||||
/**
|
||||
* @param {HTMLCanvasElement|Image|HTMLVideoElement} image Image.
|
||||
*/
|
||||
ol.Image.prototype.setImage = function(image) {
|
||||
_ol_Image_.prototype.setImage = function(image) {
|
||||
this.image_ = image;
|
||||
};
|
||||
|
||||
@@ -130,7 +131,8 @@ ol.Image.prototype.setImage = function(image) {
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
ol.Image.prototype.unlistenImage_ = function() {
|
||||
this.imageListenerKeys_.forEach(ol.events.unlistenByKey);
|
||||
_ol_Image_.prototype.unlistenImage_ = function() {
|
||||
this.imageListenerKeys_.forEach(_ol_events_.unlistenByKey);
|
||||
this.imageListenerKeys_ = null;
|
||||
};
|
||||
export default _ol_Image_;
|
||||
|
||||
Reference in New Issue
Block a user