Shared module for tile source event type
This commit is contained in:
@@ -334,32 +334,3 @@ ol.source.Tile.Event = function(type, tile) {
|
||||
|
||||
};
|
||||
ol.inherits(ol.source.Tile.Event, ol.events.Event);
|
||||
|
||||
|
||||
/**
|
||||
* @enum {string}
|
||||
*/
|
||||
ol.source.Tile.EventType = {
|
||||
|
||||
/**
|
||||
* Triggered when a tile starts loading.
|
||||
* @event ol.source.Tile.Event#tileloadstart
|
||||
* @api stable
|
||||
*/
|
||||
TILELOADSTART: 'tileloadstart',
|
||||
|
||||
/**
|
||||
* Triggered when a tile finishes loading.
|
||||
* @event ol.source.Tile.Event#tileloadend
|
||||
* @api stable
|
||||
*/
|
||||
TILELOADEND: 'tileloadend',
|
||||
|
||||
/**
|
||||
* Triggered if tile loading results in an error.
|
||||
* @event ol.source.Tile.Event#tileloaderror
|
||||
* @api stable
|
||||
*/
|
||||
TILELOADERROR: 'tileloaderror'
|
||||
|
||||
};
|
||||
|
||||
29
src/ol/source/tileeventtype.js
Normal file
29
src/ol/source/tileeventtype.js
Normal file
@@ -0,0 +1,29 @@
|
||||
goog.provide('ol.source.TileEventType');
|
||||
|
||||
/**
|
||||
* @enum {string}
|
||||
*/
|
||||
ol.source.TileEventType = {
|
||||
|
||||
/**
|
||||
* Triggered when a tile starts loading.
|
||||
* @event ol.source.Tile.Event#tileloadstart
|
||||
* @api stable
|
||||
*/
|
||||
TILELOADSTART: 'tileloadstart',
|
||||
|
||||
/**
|
||||
* Triggered when a tile finishes loading.
|
||||
* @event ol.source.Tile.Event#tileloadend
|
||||
* @api stable
|
||||
*/
|
||||
TILELOADEND: 'tileloadend',
|
||||
|
||||
/**
|
||||
* Triggered if tile loading results in an error.
|
||||
* @event ol.source.Tile.Event#tileloaderror
|
||||
* @api stable
|
||||
*/
|
||||
TILELOADERROR: 'tileloaderror'
|
||||
|
||||
};
|
||||
@@ -4,6 +4,7 @@ goog.require('ol');
|
||||
goog.require('ol.TileState');
|
||||
goog.require('ol.TileUrlFunction');
|
||||
goog.require('ol.source.Tile');
|
||||
goog.require('ol.source.TileEventType');
|
||||
|
||||
|
||||
/**
|
||||
@@ -111,15 +112,15 @@ ol.source.UrlTile.prototype.handleTileChange = function(event) {
|
||||
switch (tile.getState()) {
|
||||
case ol.TileState.LOADING:
|
||||
this.dispatchEvent(
|
||||
new ol.source.Tile.Event(ol.source.Tile.EventType.TILELOADSTART, tile));
|
||||
new ol.source.Tile.Event(ol.source.TileEventType.TILELOADSTART, tile));
|
||||
break;
|
||||
case ol.TileState.LOADED:
|
||||
this.dispatchEvent(
|
||||
new ol.source.Tile.Event(ol.source.Tile.EventType.TILELOADEND, tile));
|
||||
new ol.source.Tile.Event(ol.source.TileEventType.TILELOADEND, tile));
|
||||
break;
|
||||
case ol.TileState.ERROR:
|
||||
this.dispatchEvent(
|
||||
new ol.source.Tile.Event(ol.source.Tile.EventType.TILELOADERROR, tile));
|
||||
new ol.source.Tile.Event(ol.source.TileEventType.TILELOADERROR, tile));
|
||||
break;
|
||||
default:
|
||||
// pass
|
||||
|
||||
Reference in New Issue
Block a user