mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-25 06:36:11 +03:00
outsourced tile sorting from tile comparing.
This commit is contained in:
parent
ccb4ae9f86
commit
17873001b8
@ -1931,7 +1931,21 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag
|
|||||||
}
|
}
|
||||||
previousBest.push(tile);
|
previousBest.push(tile);
|
||||||
if (previousBest.length > maxNTiles) {
|
if (previousBest.length > maxNTiles) {
|
||||||
previousBest.sort(function (a, b) {
|
this._sortTiles(previousBest);
|
||||||
|
previousBest.pop();
|
||||||
|
}
|
||||||
|
return previousBest;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
* @inner
|
||||||
|
* Sorts tiles in an array according to distance and visibility.
|
||||||
|
*
|
||||||
|
* @param {OpenSeadragon.Tile[]} tiles The tiles.
|
||||||
|
*/
|
||||||
|
_sortTiles: function( tiles ) {
|
||||||
|
tiles.sort(function (a, b) {
|
||||||
if (a === null) {
|
if (a === null) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -1944,9 +1958,6 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag
|
|||||||
return (a.visibility - b.visibility);
|
return (a.visibility - b.visibility);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
previousBest.pop();
|
|
||||||
}
|
|
||||||
return previousBest;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user