diff --git a/src/tiledimage.js b/src/tiledimage.js index 3e8b88b3..a2d6c34c 100644 --- a/src/tiledimage.js +++ b/src/tiledimage.js @@ -298,19 +298,25 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag /** * Updates the TiledImage's bounds, animating if needed. Based on the new * bounds, updates the levels and tiles to be drawn into the viewport. + * @param viewportChanged Whether the viewport changed meaning tiles need to be updated. * @returns {Boolean} Whether the TiledImage needs to be drawn. */ - update: function() { - var xUpdated = this._xSpring.update(); - var yUpdated = this._ySpring.update(); - var scaleUpdated = this._scaleSpring.update(); - var degreesUpdated = this._degreesSpring.update(); + update: function(viewportChanged) { + let xUpdated = this._xSpring.update(); + let yUpdated = this._ySpring.update(); + let scaleUpdated = this._scaleSpring.update(); + let degreesUpdated = this._degreesSpring.update(); - let fullyLoadedFlag = this._updateLevelsForViewport(); - this._updateTilesInViewport(); - this._setFullyLoaded(fullyLoadedFlag); + let updated = (xUpdated || yUpdated || scaleUpdated || degreesUpdated); - if (xUpdated || yUpdated || scaleUpdated || degreesUpdated) { + if (updated || viewportChanged || !this._fullyLoaded){ + let fullyLoadedFlag = this._updateLevelsForViewport(); + this._updateTilesInViewport(); + this._setFullyLoaded(fullyLoadedFlag); + } + + + if (updated) { this._updateForScale(); this._raiseBoundsChange(); this._needsDraw = true; diff --git a/src/viewer.js b/src/viewer.js index 39e1a7b6..da334094 100644 --- a/src/viewer.js +++ b/src/viewer.js @@ -3749,7 +3749,7 @@ function updateOnce( viewer ) { var viewportChange = viewer.viewport.update(); - var animated = viewer.world.update() || viewportChange; + var animated = viewer.world.update(viewportChange) || viewportChange; if (viewportChange) { /** diff --git a/src/world.js b/src/world.js index a30ed9f9..e766045d 100644 --- a/src/world.js +++ b/src/world.js @@ -243,10 +243,10 @@ $.extend( $.World.prototype, $.EventSource.prototype, /** @lends OpenSeadragon.W /** * Updates (i.e. animates bounds of) all items. */ - update: function() { + update: function(viewportChanged) { var animated = false; for ( var i = 0; i < this._items.length; i++ ) { - animated = this._items[i].update() || animated; + animated = this._items[i].update(viewportChanged) || animated; } return animated;