mirror of
https://github.com/openseadragon/openseadragon.git
synced 2025-03-29 03:39:50 +03:00
Fixed _updateViewport to come to a fullyLoaded state with n tiles.
Improved _compareTiles
This commit is contained in:
parent
9684a83b8c
commit
ccb4ae9f86
1 changed files with 14 additions and 14 deletions
|
@ -1276,7 +1276,7 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag
|
||||||
this._drawTiles(this.lastDrawn);
|
this._drawTiles(this.lastDrawn);
|
||||||
|
|
||||||
// Load the new 'best' n tiles
|
// Load the new 'best' n tiles
|
||||||
if (bestTiles) {
|
if (bestTiles && bestTiles.length > 0) {
|
||||||
bestTiles.forEach(function (tile) {
|
bestTiles.forEach(function (tile) {
|
||||||
if (tile && !tile.context2D) {
|
if (tile && !tile.context2D) {
|
||||||
this._loadTile(tile, currentTime);
|
this._loadTile(tile, currentTime);
|
||||||
|
@ -1930,20 +1930,20 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag
|
||||||
return [tile];
|
return [tile];
|
||||||
}
|
}
|
||||||
previousBest.push(tile);
|
previousBest.push(tile);
|
||||||
previousBest.sort(function (a, b) {
|
|
||||||
if (a === null) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if (b === null) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (a.visibility === b.visibility) {
|
|
||||||
return (a.squaredDistance - b.squaredDistance);
|
|
||||||
} else {
|
|
||||||
return (a.visibility - b.visibility);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
if (previousBest.length > maxNTiles) {
|
if (previousBest.length > maxNTiles) {
|
||||||
|
previousBest.sort(function (a, b) {
|
||||||
|
if (a === null) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if (b === null) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (a.visibility === b.visibility) {
|
||||||
|
return (a.squaredDistance - b.squaredDistance);
|
||||||
|
} else {
|
||||||
|
return (a.visibility - b.visibility);
|
||||||
|
}
|
||||||
|
});
|
||||||
previousBest.pop();
|
previousBest.pop();
|
||||||
}
|
}
|
||||||
return previousBest;
|
return previousBest;
|
||||||
|
|
Loading…
Add table
Reference in a new issue