diff --git a/src/tile.js b/src/tile.js index b41aa9e9..45f2823b 100644 --- a/src/tile.js +++ b/src/tile.js @@ -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); } diff --git a/src/tilesource.js b/src/tilesource.js index cba91511..2c99db29 100644 --- a/src/tilesource.js +++ b/src/tilesource.js @@ -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); }, /**