mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-22 05:06:09 +03:00
remove unused code paths
This commit is contained in:
parent
3f03bd6e20
commit
be30b429f8
@ -34,7 +34,7 @@
|
|||||||
|
|
||||||
(function( $ ){
|
(function( $ ){
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* You shouldn't have to create a TiledImage instance directly; get it asynchronously by
|
* You shouldn't have to create a TiledImage instance directly; get it asynchronously by
|
||||||
* using {@link OpenSeadragon.Viewer#open} or {@link OpenSeadragon.Viewer#addTiledImage} instead.
|
* using {@link OpenSeadragon.Viewer#open} or {@link OpenSeadragon.Viewer#addTiledImage} instead.
|
||||||
* @class TiledImage
|
* @class TiledImage
|
||||||
@ -84,7 +84,7 @@
|
|||||||
* @param {Object} [options.ajaxHeaders={}]
|
* @param {Object} [options.ajaxHeaders={}]
|
||||||
* A set of headers to include when making tile AJAX requests.
|
* A set of headers to include when making tile AJAX requests.
|
||||||
*/
|
*/
|
||||||
$.TiledImage = function( options ) {
|
$.TiledImage = function( options ) {
|
||||||
this._initialized = false;
|
this._initialized = false;
|
||||||
/**
|
/**
|
||||||
* The {@link OpenSeadragon.TileSource} that defines this TiledImage.
|
* The {@link OpenSeadragon.TileSource} that defines this TiledImage.
|
||||||
@ -229,9 +229,9 @@ $.TiledImage = function( options ) {
|
|||||||
this._ownAjaxHeaders = {};
|
this._ownAjaxHeaders = {};
|
||||||
this.setAjaxHeaders(ajaxHeaders, false);
|
this.setAjaxHeaders(ajaxHeaders, false);
|
||||||
this._initialized = true;
|
this._initialized = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
$.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadragon.TiledImage.prototype */{
|
$.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadragon.TiledImage.prototype */{
|
||||||
/**
|
/**
|
||||||
* @returns {Boolean} Whether the TiledImage needs to be drawn.
|
* @returns {Boolean} Whether the TiledImage needs to be drawn.
|
||||||
*/
|
*/
|
||||||
@ -1312,10 +1312,9 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag
|
|||||||
// returns boolean flag of whether the image should be marked as fully loaded
|
// returns boolean flag of whether the image should be marked as fully loaded
|
||||||
_updateLevelsForViewport: function(){
|
_updateLevelsForViewport: function(){
|
||||||
var levelsInterval = this._getLevelsInterval();
|
var levelsInterval = this._getLevelsInterval();
|
||||||
var lowestLevel = levelsInterval.lowestLevel;
|
var lowestLevel = levelsInterval.lowestLevel; // the lowest level we should draw at our current zoom
|
||||||
var highestLevel = levelsInterval.highestLevel;
|
var highestLevel = levelsInterval.highestLevel; // the highest level we should draw at our current zoom
|
||||||
var bestTiles = [];
|
var bestTiles = [];
|
||||||
var haveDrawn = false;
|
|
||||||
var drawArea = this.getDrawArea();
|
var drawArea = this.getDrawArea();
|
||||||
var currentTime = $.now();
|
var currentTime = $.now();
|
||||||
|
|
||||||
@ -1339,6 +1338,7 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag
|
|||||||
for(let i = 0, level = highestLevel; level >= lowestLevel; level--, i++){
|
for(let i = 0, level = highestLevel; level >= lowestLevel; level--, i++){
|
||||||
levelList[i] = level;
|
levelList[i] = level;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if a single-tile level is loaded, add that to the end of the list
|
// if a single-tile level is loaded, add that to the end of the list
|
||||||
// as a fallback to use during zooming out, until a lower-res tile is
|
// as a fallback to use during zooming out, until a lower-res tile is
|
||||||
// loaded
|
// loaded
|
||||||
@ -1350,32 +1350,23 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag
|
|||||||
);
|
);
|
||||||
if(tile && tile.isBottomMost && tile.isRightMost && tile.loaded){
|
if(tile && tile.isBottomMost && tile.isRightMost && tile.loaded){
|
||||||
levelList.push(level);
|
levelList.push(level);
|
||||||
levelList.hasHigherResolutionFallback = true;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Update any level that will be drawn
|
// Update any level that will be drawn.
|
||||||
|
// We are iterating from highest resolution to lowest resolution
|
||||||
|
// Once a level fully covers the viewport the loop is halted and
|
||||||
|
// lower-resolution levels are skipped
|
||||||
for (let i = 0; i < levelList.length; i++) {
|
for (let i = 0; i < levelList.length; i++) {
|
||||||
let level = levelList[i];
|
let level = levelList[i];
|
||||||
var drawLevel = false;
|
|
||||||
|
|
||||||
//Avoid calculations for draw if we have already drawn this
|
|
||||||
var currentRenderPixelRatio = this.viewport.deltaPixelsFromPointsNoRotate(
|
var currentRenderPixelRatio = this.viewport.deltaPixelsFromPointsNoRotate(
|
||||||
this.source.getPixelRatio(level),
|
this.source.getPixelRatio(level),
|
||||||
true
|
true
|
||||||
).x * this._scaleSpring.current.value;
|
).x * this._scaleSpring.current.value;
|
||||||
|
|
||||||
if (i === levelList.length - 1 ||
|
|
||||||
(!haveDrawn && currentRenderPixelRatio >= this.minPixelRatio) ) {
|
|
||||||
drawLevel = true;
|
|
||||||
haveDrawn = true;
|
|
||||||
} else if (!haveDrawn) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Perform calculations for draw if we haven't drawn this
|
|
||||||
var targetRenderPixelRatio = this.viewport.deltaPixelsFromPointsNoRotate(
|
var targetRenderPixelRatio = this.viewport.deltaPixelsFromPointsNoRotate(
|
||||||
this.source.getPixelRatio(level),
|
this.source.getPixelRatio(level),
|
||||||
false
|
false
|
||||||
@ -1398,10 +1389,7 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Update the level and keep track of 'best' tiles to load
|
// Update the level and keep track of 'best' tiles to load
|
||||||
// the bestTiles
|
|
||||||
var result = this._updateLevel(
|
var result = this._updateLevel(
|
||||||
haveDrawn,
|
|
||||||
drawLevel,
|
|
||||||
level,
|
level,
|
||||||
levelOpacity,
|
levelOpacity,
|
||||||
levelVisibility,
|
levelVisibility,
|
||||||
@ -1558,8 +1546,6 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag
|
|||||||
/**
|
/**
|
||||||
* Updates all tiles at a given resolution level.
|
* Updates all tiles at a given resolution level.
|
||||||
* @private
|
* @private
|
||||||
* @param {Boolean} haveDrawn
|
|
||||||
* @param {Boolean} drawLevel
|
|
||||||
* @param {Number} level
|
* @param {Number} level
|
||||||
* @param {Number} levelOpacity
|
* @param {Number} levelOpacity
|
||||||
* @param {Number} levelVisibility
|
* @param {Number} levelVisibility
|
||||||
@ -1568,7 +1554,7 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag
|
|||||||
* @param {OpenSeadragon.Tile[]} best Array of the current best tiles
|
* @param {OpenSeadragon.Tile[]} best Array of the current best tiles
|
||||||
* @returns {Object} Dictionary {bestTiles: OpenSeadragon.Tile - the current "best" tiles to draw, updatedTiles: OpenSeadragon.Tile) - the updated tiles}.
|
* @returns {Object} Dictionary {bestTiles: OpenSeadragon.Tile - the current "best" tiles to draw, updatedTiles: OpenSeadragon.Tile) - the updated tiles}.
|
||||||
*/
|
*/
|
||||||
_updateLevel: function(haveDrawn, drawLevel, level, levelOpacity,
|
_updateLevel: function(level, levelOpacity,
|
||||||
levelVisibility, drawArea, currentTime, best) {
|
levelVisibility, drawArea, currentTime, best) {
|
||||||
|
|
||||||
var topLeftBound = drawArea.getBoundingBox().getTopLeft();
|
var topLeftBound = drawArea.getBoundingBox().getTopLeft();
|
||||||
@ -1583,7 +1569,7 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag
|
|||||||
* @type {object}
|
* @type {object}
|
||||||
* @property {OpenSeadragon.Viewer} eventSource - A reference to the Viewer which raised the event.
|
* @property {OpenSeadragon.Viewer} eventSource - A reference to the Viewer which raised the event.
|
||||||
* @property {OpenSeadragon.TiledImage} tiledImage - Which TiledImage is being drawn.
|
* @property {OpenSeadragon.TiledImage} tiledImage - Which TiledImage is being drawn.
|
||||||
* @property {Object} havedrawn
|
* @property {Object} havedrawn - deprecated, always true (kept for backwards compatibility)
|
||||||
* @property {Object} level
|
* @property {Object} level
|
||||||
* @property {Object} opacity
|
* @property {Object} opacity
|
||||||
* @property {Object} visibility
|
* @property {Object} visibility
|
||||||
@ -1596,7 +1582,7 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag
|
|||||||
*/
|
*/
|
||||||
this.viewer.raiseEvent('update-level', {
|
this.viewer.raiseEvent('update-level', {
|
||||||
tiledImage: this,
|
tiledImage: this,
|
||||||
havedrawn: haveDrawn,
|
havedrawn: true, // deprecated, kept for backwards compatibility
|
||||||
level: level,
|
level: level,
|
||||||
opacity: levelOpacity,
|
opacity: levelOpacity,
|
||||||
visibility: levelVisibility,
|
visibility: levelVisibility,
|
||||||
@ -1651,8 +1637,6 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag
|
|||||||
}
|
}
|
||||||
|
|
||||||
var result = this._updateTile(
|
var result = this._updateTile(
|
||||||
haveDrawn,
|
|
||||||
drawLevel,
|
|
||||||
flippedX, y,
|
flippedX, y,
|
||||||
level,
|
level,
|
||||||
levelVisibility,
|
levelVisibility,
|
||||||
@ -1729,8 +1713,6 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag
|
|||||||
/**
|
/**
|
||||||
* Update a single tile at a particular resolution level.
|
* Update a single tile at a particular resolution level.
|
||||||
* @private
|
* @private
|
||||||
* @param {Boolean} haveDrawn
|
|
||||||
* @param {Boolean} drawLevel
|
|
||||||
* @param {Number} x
|
* @param {Number} x
|
||||||
* @param {Number} y
|
* @param {Number} y
|
||||||
* @param {Number} level
|
* @param {Number} level
|
||||||
@ -1741,7 +1723,7 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag
|
|||||||
* @param {OpenSeadragon.Tile} best - The current "best" tile to draw.
|
* @param {OpenSeadragon.Tile} best - The current "best" tile to draw.
|
||||||
* @returns {Object} Dictionary {bestTiles: OpenSeadragon.Tile[] - the current best tiles, tile: OpenSeadragon.Tile the current tile}
|
* @returns {Object} Dictionary {bestTiles: OpenSeadragon.Tile[] - the current best tiles, tile: OpenSeadragon.Tile the current tile}
|
||||||
*/
|
*/
|
||||||
_updateTile: function( haveDrawn, drawLevel, x, y, level,
|
_updateTile: function( x, y, level,
|
||||||
levelVisibility, viewportCenter, numberOfTiles, currentTime, best){
|
levelVisibility, viewportCenter, numberOfTiles, currentTime, best){
|
||||||
|
|
||||||
var tile = this._getTile(
|
var tile = this._getTile(
|
||||||
@ -1749,8 +1731,7 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag
|
|||||||
level,
|
level,
|
||||||
currentTime,
|
currentTime,
|
||||||
numberOfTiles
|
numberOfTiles
|
||||||
),
|
);
|
||||||
drawTile = drawLevel;
|
|
||||||
|
|
||||||
if( this.viewer ){
|
if( this.viewer ){
|
||||||
/**
|
/**
|
||||||
@ -1784,20 +1765,6 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag
|
|||||||
if (tile.loaded && tile.opacity === 1){
|
if (tile.loaded && tile.opacity === 1){
|
||||||
this._setCoverage( this.coverage, level, x, y, true );
|
this._setCoverage( this.coverage, level, x, y, true );
|
||||||
}
|
}
|
||||||
if ( drawTile && !haveDrawn ) {
|
|
||||||
if ( this._isCovered( this.coverage, level, x, y ) ) {
|
|
||||||
this._setCoverage( this.coverage, level, x, y, true );
|
|
||||||
} else {
|
|
||||||
haveDrawn = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( !haveDrawn ) {
|
|
||||||
return {
|
|
||||||
bestTiles: best,
|
|
||||||
tile: tile
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
this._positionTile(
|
this._positionTile(
|
||||||
tile,
|
tile,
|
||||||
@ -2304,8 +2271,8 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag
|
|||||||
_resetCoverage: function( coverage, level ) {
|
_resetCoverage: function( coverage, level ) {
|
||||||
coverage[ level ] = {};
|
coverage[ level ] = {};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}( OpenSeadragon ));
|
}( OpenSeadragon ));
|
||||||
|
Loading…
Reference in New Issue
Block a user