mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-21 20:56:09 +03:00
only calculate tile positions when necessary
This commit is contained in:
parent
0584ca7be9
commit
128975ea0f
@ -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;
|
||||
|
@ -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) {
|
||||
/**
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user