diff --git a/src/tile.js b/src/tile.js index 582ccb67..9d29028a 100644 --- a/src/tile.js +++ b/src/tile.js @@ -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 diff --git a/src/tilesource.js b/src/tilesource.js index 7a7e991c..36316a1d 100644 --- a/src/tilesource.js +++ b/src/tilesource.js @@ -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 {