supports relative tile urls

This commit is contained in:
Francisco Dans 2015-09-29 12:54:26 +02:00
parent e4aa398f6e
commit b212913530

View File

@ -254,9 +254,7 @@
.replace('{y}', coord.y)
.replace('{z}', zoom)
.replace('{s}', subdomains[index])
var extra = this._extraParams();
torque.net.get( url + (extra ? "?" + extra: ''), function (data) {
torque.net.get( url , function (data) {
if (data && data.responseText) {
var rows = JSON.parse(data.responseText);
callback(self.proccessTile(rows, coord, zoom));
@ -327,6 +325,9 @@
self.options[k] = data[k];
}
self.templateUrl = data.tiles[0];
if (self.templateUrl.indexOf("http") !== 0){
self.templateUrl = self.options.tileJSON.substring(0, self.options.tileJSON.lastIndexOf("/") + 1) + self.templateUrl;
}
self._setReady(true);
}
});