kopia lustrzana https://github.com/robhawkes/vizicities
Optimization: Re-use tile URL regex in BlueprintInputMapTiles
rodzic
b5c3e0379f
commit
67f55b1eb4
|
@ -13,6 +13,9 @@
|
|||
// tilePath: "https://a.tiles.mapbox.com/v3/examples.map-i86l3621/{z}/{x}/{y}@2x.png"
|
||||
// }
|
||||
// }
|
||||
|
||||
var tileURLRegex = /\{([zxy])\}/g;
|
||||
|
||||
VIZI.BlueprintInputMapTiles = function(options) {
|
||||
var self = this;
|
||||
|
||||
|
@ -53,7 +56,8 @@
|
|||
if (VIZI.DEBUG) console.log("Requesting tiles", tiles);
|
||||
|
||||
_.each(tiles, function(tile, key) {
|
||||
var url = self.options.tilePath.replace(/\{([zxy])\}/g, function(value, key) {
|
||||
tileURLRegex.lastIndex = 0;
|
||||
var url = self.options.tilePath.replace(tileURLRegex, function(value, key) {
|
||||
// Replace with paramter, otherwise keep existing value
|
||||
return tile[key];
|
||||
});
|
||||
|
|
Ładowanie…
Reference in New Issue