mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-13 01:02:58 +00:00
merge d3.geo.tile changes from upstream
This commit is contained in:
@@ -2,7 +2,8 @@ d3.geo.tile = function() {
|
||||
var size = [960, 500],
|
||||
scale = 256,
|
||||
scaleExtent = [0, 20],
|
||||
translate = [size[0] / 2, size[1] / 2];
|
||||
translate = [size[0] / 2, size[1] / 2],
|
||||
zoomDelta = 0;
|
||||
|
||||
function bound(_) {
|
||||
return Math.min(scaleExtent[1], Math.max(scaleExtent[0], _));
|
||||
@@ -10,7 +11,7 @@ d3.geo.tile = function() {
|
||||
|
||||
function tile() {
|
||||
var z = Math.max(Math.log(scale) / Math.LN2 - 8, 0),
|
||||
z0 = bound(z | 0),
|
||||
z0 = bound(Math.round(z + zoomDelta)),
|
||||
k = Math.pow(2, z - z0 + 8),
|
||||
origin = [(translate[0] - scale / 2) / k, (translate[1] - scale / 2) / k],
|
||||
tiles = [],
|
||||
@@ -53,5 +54,11 @@ d3.geo.tile = function() {
|
||||
return tile;
|
||||
};
|
||||
|
||||
tile.zoomDelta = function(_) {
|
||||
if (!arguments.length) return zoomDelta;
|
||||
zoomDelta = +_;
|
||||
return tile;
|
||||
};
|
||||
|
||||
return tile;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user