add support for multiple subdomains

This commit is contained in:
javi 2013-08-23 18:00:42 +02:00
parent 97890c0a81
commit af367f9aa9

View File

@ -161,12 +161,18 @@
},
getTile: function(coord, zoom, callback) {
tileUrl: function(coord, zoom) {
var template = this.url();
template = template
var s = (this.options.subdomains || 'abcd')[(coord.x + coord.y + zoom) % 4];
return template
.replace('{x}', coord.x)
.replace('{y}', coord.y)
.replace('{z}', zoom);
.replace('{z}', zoom)
.replace('{s}', s);
},
getTile: function(coord, zoom, callback) {
var template = this.tileUrl(coord, zoom);
var self = this;
var fetchTime = Profiler.metric('jsonarray:fetch time');
@ -185,11 +191,7 @@
* `zoom` quadtree zoom level
*/
getTileData: function(coord, zoom, callback) {
var template = this.url();
template = template
.replace('{x}', coord.x)
.replace('{y}', coord.y)
.replace('{z}', zoom);
var template = this.tileUrl(coord, zoom);
var self = this;
var fetchTime = Profiler.metric('jsonarray:fetch time');