Respect tile layer minimum scaleExtent

Rather than attempting to render an exponential number
of tiles for each z less that the minimum, render none.
This commit is contained in:
John Firebaugh
2013-07-12 15:44:59 -07:00
parent 6c2d90dcaf
commit ab566c8fa7

View File

@@ -76,18 +76,20 @@ iD.Background = function(backgroundType) {
function render(selection) {
var requests = [];
tile().forEach(function(d) {
addSource(d);
requests.push(d);
if (cache[d[3]] === false && lookUp(d)) {
requests.push(addSource(lookUp(d)));
}
});
if (tile.scaleExtent()[0] <= z) {
tile().forEach(function(d) {
addSource(d);
requests.push(d);
if (cache[d[3]] === false && lookUp(d)) {
requests.push(addSource(lookUp(d)));
}
});
requests = uniqueBy(requests, 3).filter(function(r) {
// don't re-request tiles which have failed in the past
return cache[r[3]] !== false;
});
requests = uniqueBy(requests, 3).filter(function(r) {
// don't re-request tiles which have failed in the past
return cache[r[3]] !== false;
});
}
var pixelOffset = [
Math.round(offset[0] * Math.pow(2, z)),