Render is only complete when no tiles are queued

This commit is contained in:
Andreas Hocevar
2021-12-06 23:03:40 +01:00
parent 238695a107
commit c59047c965
+12 -2
View File
@@ -208,6 +208,12 @@ class PluggableMap extends BaseObject {
const optionsInternal = createOptionsInternal(options); const optionsInternal = createOptionsInternal(options);
/**
* @private
* @type {boolean}
*/
this.renderComplete_;
/** @private */ /** @private */
this.boundHandleBrowserEvent_ = this.handleBrowserEvent.bind(this); this.boundHandleBrowserEvent_ = this.handleBrowserEvent.bind(this);
@@ -1150,8 +1156,7 @@ class PluggableMap extends BaseObject {
frameState && frameState &&
this.hasListener(RenderEventType.RENDERCOMPLETE) && this.hasListener(RenderEventType.RENDERCOMPLETE) &&
!frameState.animate && !frameState.animate &&
!this.tileQueue_.getTilesLoading() && this.renderComplete_
!this.getLoading()
) { ) {
this.renderer_.dispatchRenderEvent( this.renderer_.dispatchRenderEvent(
RenderEventType.RENDERCOMPLETE, RenderEventType.RENDERCOMPLETE,
@@ -1528,6 +1533,11 @@ class PluggableMap extends BaseObject {
this.dispatchEvent(new MapEvent(MapEventType.POSTRENDER, this, frameState)); this.dispatchEvent(new MapEvent(MapEventType.POSTRENDER, this, frameState));
this.renderComplete_ =
!this.tileQueue_.getTilesLoading() &&
!this.tileQueue_.getCount() &&
!this.getLoading();
if (!this.postRenderTimeoutHandle_) { if (!this.postRenderTimeoutHandle_) {
this.postRenderTimeoutHandle_ = setTimeout(() => { this.postRenderTimeoutHandle_ = setTimeout(() => {
this.postRenderTimeoutHandle_ = undefined; this.postRenderTimeoutHandle_ = undefined;