Merge remote-tracking branch 'origin/cache-key' into cache-key

This commit is contained in:
Jirka 2022-04-07 14:53:20 +02:00
commit a2b915cc6d
2 changed files with 118 additions and 115 deletions

View File

@ -13,6 +13,8 @@ OPENSEADRAGON CHANGELOG
* Fixed: Setting useCanvas to false would break the viewer (#2116 @rvv-bouvet) * Fixed: Setting useCanvas to false would break the viewer (#2116 @rvv-bouvet)
* Allow silencing multi-image warnings on viewport coordinate conversion functions (#2120 @claycoleman) * Allow silencing multi-image warnings on viewport coordinate conversion functions (#2120 @claycoleman)
* Fixed: Swiping fast multiple times made contact points in MouseTracker out of sync for touch events (#2121 @ronnymikalsen) * Fixed: Swiping fast multiple times made contact points in MouseTracker out of sync for touch events (#2121 @ronnymikalsen)
* Made MouseTracker more robust in certain scenarios (#2134 @Aiosa)
* Exposed TiledImage's private functions for better maintainability (#2134 @Aiosa)
3.0.0: 3.0.0:

View File

@ -1176,7 +1176,7 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag
// Stop the loop if lower-res tiles would all be covered by // Stop the loop if lower-res tiles would all be covered by
// already drawn tiles // already drawn tiles
if ($.TiledImage._providesCoverage(this.coverage, level)) { if (this._providesCoverage(this.coverage, level)) {
break; break;
} }
} }
@ -1287,8 +1287,8 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag
}); });
} }
$.TiledImage._resetCoverage(this.coverage, level); this._resetCoverage(this.coverage, level);
$.TiledImage._resetCoverage(this.loadingCoverage, level); this._resetCoverage(this.loadingCoverage, level);
//OK, a new drawing so do your calculations //OK, a new drawing so do your calculations
var cornerTiles = this._getCornerTiles(level, topLeftBound, bottomRightBound); var cornerTiles = this._getCornerTiles(level, topLeftBound, bottomRightBound);
@ -1392,18 +1392,18 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag
}); });
} }
$.TiledImage._setCoverage( this.coverage, level, x, y, false ); this._setCoverage( this.coverage, level, x, y, false );
var loadingCoverage = tile.loaded || tile.loading || $.TiledImage._isCovered(this.loadingCoverage, level, x, y); var loadingCoverage = tile.loaded || tile.loading || this._isCovered(this.loadingCoverage, level, x, y);
$.TiledImage._setCoverage(this.loadingCoverage, level, x, y, loadingCoverage); this._setCoverage(this.loadingCoverage, level, x, y, loadingCoverage);
if ( !tile.exists ) { if ( !tile.exists ) {
return best; return best;
} }
if ( haveDrawn && !drawTile ) { if ( haveDrawn && !drawTile ) {
if ( $.TiledImage._isCovered( this.coverage, level, x, y ) ) { if ( this._isCovered( this.coverage, level, x, y ) ) {
$.TiledImage._setCoverage( this.coverage, level, x, y, true ); this._setCoverage( this.coverage, level, x, y, true );
} else { } else {
drawTile = true; drawTile = true;
} }
@ -1790,7 +1790,7 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag
this.lastDrawn.push( tile ); this.lastDrawn.push( tile );
if ( opacity === 1 ) { if ( opacity === 1 ) {
$.TiledImage._setCoverage( this.coverage, level, x, y, true ); this._setCoverage( this.coverage, level, x, y, true );
this._hasOpaqueTile = true; this._hasOpaqueTile = true;
} else if ( deltaTime < blendTimeMillis ) { } else if ( deltaTime < blendTimeMillis ) {
return true; return true;
@ -2081,10 +2081,9 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag
} }
} }
} }
} },
});
/** /**
* @private * @private
* @inner * @inner
* Returns true if the given tile provides coverage to lower-level tiles of * Returns true if the given tile provides coverage to lower-level tiles of
@ -2101,7 +2100,7 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag
* @param {Number} y - The Y position of the tile. * @param {Number} y - The Y position of the tile.
* @returns {Boolean} * @returns {Boolean}
*/ */
$.TiledImage._providesCoverage = function( coverage, level, x, y ) { _providesCoverage: function( coverage, level, x, y ) {
var rows, var rows,
cols, cols,
i, j; i, j;
@ -2131,9 +2130,9 @@ $.TiledImage._providesCoverage = function( coverage, level, x, y ) {
coverage[ level ][ x ][ y ] === undefined || coverage[ level ][ x ][ y ] === undefined ||
coverage[ level ][ x ][ y ] === true coverage[ level ][ x ][ y ] === true
); );
}; },
/** /**
* @private * @private
* @inner * @inner
* Returns true if the given tile is completely covered by higher-level * Returns true if the given tile is completely covered by higher-level
@ -2146,7 +2145,7 @@ $.TiledImage._providesCoverage = function( coverage, level, x, y ) {
* @param {Number} y - The Y position of the tile. * @param {Number} y - The Y position of the tile.
* @returns {Boolean} * @returns {Boolean}
*/ */
$.TiledImage._isCovered = function( coverage, level, x, y ) { _isCovered: function( coverage, level, x, y ) {
if ( x === undefined || y === undefined ) { if ( x === undefined || y === undefined ) {
return this._providesCoverage( coverage, level + 1 ); return this._providesCoverage( coverage, level + 1 );
} else { } else {
@ -2157,9 +2156,9 @@ $.TiledImage._isCovered = function( coverage, level, x, y ) {
this._providesCoverage( coverage, level + 1, 2 * x + 1, 2 * y + 1 ) this._providesCoverage( coverage, level + 1, 2 * x + 1, 2 * y + 1 )
); );
} }
}; },
/** /**
* @private * @private
* @inner * @inner
* Sets whether the given tile provides coverage or not. * Sets whether the given tile provides coverage or not.
@ -2170,7 +2169,7 @@ $.TiledImage._isCovered = function( coverage, level, x, y ) {
* @param {Number} y - The Y position of the tile. * @param {Number} y - The Y position of the tile.
* @param {Boolean} covers - Whether the tile provides coverage. * @param {Boolean} covers - Whether the tile provides coverage.
*/ */
$.TiledImage._setCoverage = function( coverage, level, x, y, covers ) { _setCoverage: function( coverage, level, x, y, covers ) {
if ( !coverage[ level ] ) { if ( !coverage[ level ] ) {
$.console.warn( $.console.warn(
"Setting coverage for a tile before its level's coverage has been reset: %s", "Setting coverage for a tile before its level's coverage has been reset: %s",
@ -2184,9 +2183,9 @@ $.TiledImage._setCoverage = function( coverage, level, x, y, covers ) {
} }
coverage[ level ][ x ][ y ] = covers; coverage[ level ][ x ][ y ] = covers;
}; },
/** /**
* @private * @private
* @inner * @inner
* Resets coverage information for the given level. This should be called * Resets coverage information for the given level. This should be called
@ -2196,9 +2195,11 @@ $.TiledImage._setCoverage = function( coverage, level, x, y, covers ) {
* @param {Object} coverage - A '3d' dictionary [level][x][y] --> Boolean. * @param {Object} coverage - A '3d' dictionary [level][x][y] --> Boolean.
* @param {Number} level - The resolution level of tiles to completely reset. * @param {Number} level - The resolution level of tiles to completely reset.
*/ */
$.TiledImage._resetCoverage = function( coverage, level ) { _resetCoverage: function( coverage, level ) {
coverage[ level ] = {}; coverage[ level ] = {};
}; }
});
/** /**
* @private * @private