Commit cf4c17ad authored by Mike Bostock's avatar Mike Bostock
Browse files

Revert cache of projection stream.

parent ab3149e9
......@@ -3633,12 +3633,9 @@ d3 = function() {
return stream;
}
d3.geo.path = function() {
var pointRadius = 4.5, projection, context, projectStream, contextStream, objectStream;
var pointRadius = 4.5, projection, context, projectStream, contextStream;
function path(object) {
if (object) {
if (typeof pointRadius === "function") contextStream.pointRadius(+pointRadius.apply(this, arguments));
d3.geo.stream(object, objectStream);
}
if (object) d3.geo.stream(object, projectStream(contextStream.pointRadius(typeof pointRadius === "function" ? +pointRadius.apply(this, arguments) : pointRadius)));
return contextStream.result();
}
path.area = function(object) {
......@@ -3659,19 +3656,16 @@ d3 = function() {
path.projection = function(_) {
if (!arguments.length) return projection;
projectStream = (projection = _) ? _.stream || d3_geo_pathProjectStream(_) : d3_identity;
objectStream = projectStream(contextStream);
return path;
};
path.context = function(_) {
if (!arguments.length) return context;
contextStream = (context = _) == null ? new d3_geo_pathBuffer() : new d3_geo_pathContext(_);
objectStream = projectStream(contextStream);
return path;
};
path.pointRadius = function(_) {
if (!arguments.length) return pointRadius;
pointRadius = typeof _ === "function" ? _ : (_ = +_, contextStream.pointRadius(_),
_);
pointRadius = typeof _ === "function" ? _ : +_;
return path;
};
return path.projection(d3.geo.albersUsa()).context(null);
......
This diff is collapsed.
......@@ -19,14 +19,13 @@ d3.geo.path = function() {
projection,
context,
projectStream,
contextStream,
objectStream;
contextStream;
function path(object) {
if (object) {
if (typeof pointRadius === "function") contextStream.pointRadius(+pointRadius.apply(this, arguments));
d3.geo.stream(object, objectStream);
}
if (object) d3.geo.stream(object, projectStream(
contextStream.pointRadius(typeof pointRadius === "function"
? +pointRadius.apply(this, arguments)
: pointRadius)));
return contextStream.result();
}
......@@ -51,20 +50,18 @@ d3.geo.path = function() {
path.projection = function(_) {
if (!arguments.length) return projection;
projectStream = (projection = _) ? _.stream || d3_geo_pathProjectStream(_) : d3_identity;
objectStream = projectStream(contextStream);
return path;
};
path.context = function(_) {
if (!arguments.length) return context;
contextStream = (context = _) == null ? new d3_geo_pathBuffer : new d3_geo_pathContext(_);
objectStream = projectStream(contextStream);
return path;
};
path.pointRadius = function(_) {
if (!arguments.length) return pointRadius;
pointRadius = typeof _ === "function" ? _ : (_ = +_, contextStream.pointRadius(_), _);
pointRadius = typeof _ === "function" ? _ : +_;
return path;
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment