From 3eee34a0f2c0c8bbd3c4a14076b87a3a7a39610c Mon Sep 17 00:00:00 2001 From: thejohnhoffer Date: Fri, 4 Nov 2016 17:37:48 -0400 Subject: [PATCH] count tiledImage._tilesLoading --- src/tiledimage.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/tiledimage.js b/src/tiledimage.js index e8092083..00fc520e 100644 --- a/src/tiledimage.js +++ b/src/tiledimage.js @@ -146,6 +146,7 @@ $.TiledImage = function( options ) { _midDraw: false, // Is the tiledImage currently updating the viewport? _needsDraw: true, // Does the tiledImage need to update the viewport again? _hasOpaqueTile: false, // Do we have even one fully opaque tile? + _tilesLoading: 0, // The number of pending tile requests. //configurable settings springStiffness: $.DEFAULT_SETTINGS.springStiffness, animationTime: $.DEFAULT_SETTINGS.animationTime, @@ -898,6 +899,7 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag // private _updateViewport: function() { this._needsDraw = false; + this._tilesLoading = 0; // Reset tile's internal drawn state while (this.lastDrawn.length > 0) { @@ -994,7 +996,7 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag this._needsDraw = true; this._setFullyLoaded(false); } else { - this._setFullyLoaded(true); + this._setFullyLoaded(this._tilesLoading === 0); } } }); @@ -1178,7 +1180,7 @@ function updateTile( tiledImage, drawLevel, haveDrawn, x, y, level, levelOpacity } } else if ( tile.loading ) { // the tile is already in the download queue - // thanks josh1093 for finally translating this typo + tiledImage._tilesLoading++; } else { best = compareTiles( best, tile ); }