mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-29 00:26:10 +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;
|
this.ajaxHeaders = ajaxHeaders;
|
||||||
|
|
||||||
if (cacheKey === undefined) {
|
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.");
|
" in Tile class is deprecated. TileSource.prototype.getTileHashKey will be used.");
|
||||||
cacheKey = $.TileSource.prototype.getTileHashKey(level, x, y, url, ajaxHeaders, postData);
|
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)
|
* @param {*} postData data the tile was fetched with (type depends on getTilePostData(..) return type)
|
||||||
*/
|
*/
|
||||||
getTileHashKey: function(level, x, y, url, ajaxHeaders, postData) {
|
getTileHashKey: function(level, x, y, url, ajaxHeaders, postData) {
|
||||||
if (ajaxHeaders) {
|
function withHeaders(hash) {
|
||||||
return url + "+" + JSON.stringify(ajaxHeaders);
|
return ajaxHeaders ? hash + "+" + JSON.stringify(ajaxHeaders) : hash;
|
||||||
} else {
|
|
||||||
return url;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (typeof url !== "string") {
|
||||||
|
return withHeaders(level + "/" + x + "_" + y);
|
||||||
|
}
|
||||||
|
return withHeaders(url);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user