Skip to content

Commit

Permalink
Revert cache of projection stream.
Browse files Browse the repository at this point in the history
  • Loading branch information
mbostock committed May 20, 2013
1 parent ab3149e commit cf4c17a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 19 deletions.
12 changes: 3 additions & 9 deletions d3.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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);
Expand Down
Loading

0 comments on commit cf4c17a

Please sign in to comment.