mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-26 07:06:10 +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
|
* Updates the TiledImage's bounds, animating if needed. Based on the new
|
||||||
* bounds, updates the levels and tiles to be drawn into the viewport.
|
* 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.
|
* @returns {Boolean} Whether the TiledImage needs to be drawn.
|
||||||
*/
|
*/
|
||||||
update: function() {
|
update: function(viewportChanged) {
|
||||||
var xUpdated = this._xSpring.update();
|
let xUpdated = this._xSpring.update();
|
||||||
var yUpdated = this._ySpring.update();
|
let yUpdated = this._ySpring.update();
|
||||||
var scaleUpdated = this._scaleSpring.update();
|
let scaleUpdated = this._scaleSpring.update();
|
||||||
var degreesUpdated = this._degreesSpring.update();
|
let degreesUpdated = this._degreesSpring.update();
|
||||||
|
|
||||||
|
let updated = (xUpdated || yUpdated || scaleUpdated || degreesUpdated);
|
||||||
|
|
||||||
|
if (updated || viewportChanged || !this._fullyLoaded){
|
||||||
let fullyLoadedFlag = this._updateLevelsForViewport();
|
let fullyLoadedFlag = this._updateLevelsForViewport();
|
||||||
this._updateTilesInViewport();
|
this._updateTilesInViewport();
|
||||||
this._setFullyLoaded(fullyLoadedFlag);
|
this._setFullyLoaded(fullyLoadedFlag);
|
||||||
|
}
|
||||||
|
|
||||||
if (xUpdated || yUpdated || scaleUpdated || degreesUpdated) {
|
|
||||||
|
if (updated) {
|
||||||
this._updateForScale();
|
this._updateForScale();
|
||||||
this._raiseBoundsChange();
|
this._raiseBoundsChange();
|
||||||
this._needsDraw = true;
|
this._needsDraw = true;
|
||||||
|
@ -3749,7 +3749,7 @@ function updateOnce( viewer ) {
|
|||||||
|
|
||||||
|
|
||||||
var viewportChange = viewer.viewport.update();
|
var viewportChange = viewer.viewport.update();
|
||||||
var animated = viewer.world.update() || viewportChange;
|
var animated = viewer.world.update(viewportChange) || viewportChange;
|
||||||
|
|
||||||
if (viewportChange) {
|
if (viewportChange) {
|
||||||
/**
|
/**
|
||||||
|
@ -243,10 +243,10 @@ $.extend( $.World.prototype, $.EventSource.prototype, /** @lends OpenSeadragon.W
|
|||||||
/**
|
/**
|
||||||
* Updates (i.e. animates bounds of) all items.
|
* Updates (i.e. animates bounds of) all items.
|
||||||
*/
|
*/
|
||||||
update: function() {
|
update: function(viewportChanged) {
|
||||||
var animated = false;
|
var animated = false;
|
||||||
for ( var i = 0; i < this._items.length; i++ ) {
|
for ( var i = 0; i < this._items.length; i++ ) {
|
||||||
animated = this._items[i].update() || animated;
|
animated = this._items[i].update(viewportChanged) || animated;
|
||||||
}
|
}
|
||||||
|
|
||||||
return animated;
|
return animated;
|
||||||
|
Loading…
Reference in New Issue
Block a user