mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-25 06:36:11 +03:00
Merge pull request #2190 from Aiosa/master
Provide deafult getTileHashKey implementation for "TileSource" object if missing
This commit is contained in:
commit
5e7ce1afa5
@ -129,7 +129,7 @@ $.Tile = function(level, x, y, bounds, exists, url, context2D, loadWithAjax, aja
|
||||
this.ajaxHeaders = ajaxHeaders;
|
||||
|
||||
if (cacheKey === undefined) {
|
||||
$.console.error("Tile constructor needs 'cacheKey' variable: creation tile cache" +
|
||||
$.console.warn("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);
|
||||
}
|
||||
|
@ -688,11 +688,14 @@ $.TileSource.prototype = {
|
||||
* @param {*} postData data the tile was fetched with (type depends on getTilePostData(..) return type)
|
||||
*/
|
||||
getTileHashKey: function(level, x, y, url, ajaxHeaders, postData) {
|
||||
if (ajaxHeaders) {
|
||||
return url + "+" + JSON.stringify(ajaxHeaders);
|
||||
} else {
|
||||
return url;
|
||||
function withHeaders(hash) {
|
||||
return ajaxHeaders ? hash + "+" + JSON.stringify(ajaxHeaders) : hash;
|
||||
}
|
||||
|
||||
if (typeof url !== "string") {
|
||||
return withHeaders(level + "/" + x + "_" + y);
|
||||
}
|
||||
return withHeaders(url);
|
||||
},
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user