Optimize d3.geo.bounds when no projection.
This commit is contained in:
Родитель
6866cd08d5
Коммит
4c264fb798
|
@ -5905,10 +5905,10 @@
|
|||
(d3.geo.azimuthalEquidistant = function() {
|
||||
return d3_geo_projection(d3_geo_azimuthalEquidistant);
|
||||
}).raw = d3_geo_azimuthalEquidistant;
|
||||
d3.geo.bounds = d3_geo_bounds(d3_identity);
|
||||
d3.geo.bounds = d3_geo_bounds();
|
||||
function d3_geo_bounds(projection) {
|
||||
var x0, y0, x1, y1, bound = {
|
||||
point: boundPoint,
|
||||
point: projection ? boundProjectedPoint : boundPoint,
|
||||
lineStart: d3_noop,
|
||||
lineEnd: d3_noop,
|
||||
polygonStart: function() {
|
||||
|
@ -5918,9 +5918,11 @@
|
|||
bound.point = boundPoint;
|
||||
}
|
||||
};
|
||||
function boundPoint(x, y) {
|
||||
function boundProjectedPoint(x, y) {
|
||||
var p = projection([ x, y ]);
|
||||
x = p[0], y = p[1];
|
||||
boundPoint(p[0], p[1]);
|
||||
}
|
||||
function boundPoint(x, y) {
|
||||
if (x < x0) x0 = x;
|
||||
if (x > x1) x1 = x;
|
||||
if (y < y0) y0 = y;
|
||||
|
|
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
|
@ -1,8 +1,8 @@
|
|||
d3.geo.bounds = d3_geo_bounds(d3_identity);
|
||||
d3.geo.bounds = d3_geo_bounds();
|
||||
|
||||
function d3_geo_bounds(projection) {
|
||||
var x0, y0, x1, y1, bound = {
|
||||
point: boundPoint,
|
||||
point: projection ? boundProjectedPoint : boundPoint,
|
||||
lineStart: d3_noop,
|
||||
lineEnd: d3_noop,
|
||||
|
||||
|
@ -11,9 +11,12 @@ function d3_geo_bounds(projection) {
|
|||
polygonEnd: function() { bound.point = boundPoint; }
|
||||
};
|
||||
|
||||
function boundPoint(x, y) {
|
||||
function boundProjectedPoint(x, y) {
|
||||
var p = projection([x, y]);
|
||||
x = p[0], y = p[1];
|
||||
boundPoint(p[0], p[1]);
|
||||
}
|
||||
|
||||
function boundPoint(x, y) {
|
||||
if (x < x0) x0 = x;
|
||||
if (x > x1) x1 = x;
|
||||
if (y < y0) y0 = y;
|
||||
|
|
Загрузка…
Ссылка в новой задаче