Update Tile.prototype.getTileHashKey() documentation. Provide deprecation warning for cacheKey property - now it must be passed through Tile constructor.

This commit is contained in:
Jirka 2022-04-07 14:48:26 +02:00
parent 2750100d24
commit ee2404afe3
2 changed files with 12 additions and 8 deletions

View File

@ -132,7 +132,13 @@ $.Tile = function(level, x, y, bounds, exists, url, context2D, loadWithAjax, aja
* @member {String} cacheKey
* @memberof OpenSeadragon.Tile#
*/
if (cacheKey === undefined) {
$.console.error("Tile constructor needs 'cacheKey' variable: creation tile cache" +
" in Tile class is deprecated. TileSource.prototype.getTileHashKey will be used.");
cacheKey = $.TileSource.prototype.getTileHashKey(level, x, y, url, ajaxHeaders, postData);
}
this.cacheKey = cacheKey;
/**
* Is this tile loaded?
* @member {Boolean} loaded

View File

@ -671,21 +671,19 @@ $.TileSource.prototype = {
},
/**
* Most tiles are cached because their 'context2D' property is null (otherwise no caching occurs).
* Then, their cache is uniquely determined by this key: this key should be different if images
* are different! Note: default behaviour does not take into account post data.
*
* A tile can have either context2D defined (TileSource.prototype.getContext2D)
* or it's context2D is set manually. In those cases cache is not used and this function
* is irrelevant.
* or its context2D is set manually. In those cases cache is not used and this function
* is irrelevant. Otherwise, the tile cache object is uniquely determined by this key:
* keys should be different if images are different!
* Note: default behaviour does not take into account post data.
* @param level tile level it was fetched with
* @param x x-coordinate in the pyramid level
* @param y y-coordinate in the pyramid level
* @param url the tile was fetched with
* @param ajaxHeaders the tile was fetched with
* @param post data the tile was fetched with
* @param postData data the tile was fetched with
*/
getTileHashKey: function(level, x, y, url, ajaxHeaders, post) {
getTileHashKey: function(level, x, y, url, ajaxHeaders, postData) {
if (ajaxHeaders) {
return url + "+" + JSON.stringify(ajaxHeaders);
} else {