Add 'rendercomplete' event
This commit is contained in:
@@ -201,16 +201,19 @@ class ImageSource extends Source {
|
||||
const image = /** @type {module:ol/Image} */ (event.target);
|
||||
switch (image.getState()) {
|
||||
case ImageState.LOADING:
|
||||
this.loading = true;
|
||||
this.dispatchEvent(
|
||||
new ImageSourceEvent(ImageSourceEventType.IMAGELOADSTART,
|
||||
image));
|
||||
break;
|
||||
case ImageState.LOADED:
|
||||
this.loading = false;
|
||||
this.dispatchEvent(
|
||||
new ImageSourceEvent(ImageSourceEventType.IMAGELOADEND,
|
||||
image));
|
||||
break;
|
||||
case ImageState.ERROR:
|
||||
this.loading = false;
|
||||
this.dispatchEvent(
|
||||
new ImageSourceEvent(ImageSourceEventType.IMAGELOADERROR,
|
||||
image));
|
||||
|
||||
@@ -66,6 +66,13 @@ class Source extends BaseObject {
|
||||
*/
|
||||
this.attributions_ = this.adaptAttributions_(options.attributions);
|
||||
|
||||
/**
|
||||
* This source is currently loading data. Sources that defer loading to the
|
||||
* map's tile queue never set this to `true`.
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.loading = false;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/source/State}
|
||||
|
||||
@@ -871,6 +871,7 @@ class VectorSource extends Source {
|
||||
loadFeatures(extent, resolution, projection) {
|
||||
const loadedExtentsRtree = this.loadedExtentsRtree_;
|
||||
const extentsToLoad = this.strategy_(extent, resolution);
|
||||
this.loading = false;
|
||||
for (let i = 0, ii = extentsToLoad.length; i < ii; ++i) {
|
||||
const extentToLoad = extentsToLoad[i];
|
||||
const alreadyLoaded = loadedExtentsRtree.forEachInExtent(extentToLoad,
|
||||
@@ -884,6 +885,7 @@ class VectorSource extends Source {
|
||||
if (!alreadyLoaded) {
|
||||
this.loader_.call(this, extentToLoad, resolution, projection);
|
||||
loadedExtentsRtree.insert(extentToLoad, {extent: extentToLoad.slice()});
|
||||
this.loading = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user