Commit 25938054 by Zachary Tong

Move directive-level variables out of scope

parent 5a5e4cef
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* clip on spheres appropriately. To fix this, we would need to translate * clip on spheres appropriately. To fix this, we would need to translate
* the svg path into a geo-path * the svg path into a geo-path
*/ */
function displayBinning(scope, dimensions) { function displayBinning(scope, dr, dimensions) {
var hexbin = d3.hexbin() var hexbin = d3.hexbin()
.size(dimensions) .size(dimensions)
...@@ -31,12 +31,12 @@ function displayBinning(scope, dimensions) { ...@@ -31,12 +31,12 @@ function displayBinning(scope, dimensions) {
_.map(scope.data, function (k, v) { _.map(scope.data, function (k, v) {
var decoded = geohash.decode(v); var decoded = geohash.decode(v);
return _.map(_.range(0, k*scale), function(a,b) { return _.map(_.range(0, k*scale), function(a,b) {
binPoints.push(scope.projection([decoded.longitude, decoded.latitude])); binPoints.push(dr.projection([decoded.longitude, decoded.latitude]));
}) })
}); });
} else { } else {
binPoints = scope.projectedPoints; binPoints = dr.projectedPoints;
} }
//bin and sort the points, so we can set the various ranges appropriately //bin and sort the points, so we can set the various ranges appropriately
...@@ -64,7 +64,7 @@ function displayBinning(scope, dimensions) { ...@@ -64,7 +64,7 @@ function displayBinning(scope, dimensions) {
.interpolate(d3.interpolateLab); .interpolate(d3.interpolateLab);
var hex = scope.g.selectAll(".hexagon") var hex = dr.g.selectAll(".hexagon")
.data(binnedPoints); .data(binnedPoints);
hex.enter().append("path") hex.enter().append("path")
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* Renders bullseyes as geo-json poly gon entities * Renders bullseyes as geo-json poly gon entities
* Allows for them to clip on spheres correctly * Allows for them to clip on spheres correctly
*/ */
function displayBullseye(scope, path) { function displayBullseye(scope, dr, path) {
var degrees = 180 / Math.PI var degrees = 180 / Math.PI
var circle = d3.geo.circle(); var circle = d3.geo.circle();
...@@ -14,7 +14,7 @@ function displayBullseye(scope, path) { ...@@ -14,7 +14,7 @@ function displayBullseye(scope, path) {
]; ];
} }
var arcs = scope.g.selectAll(".arc") var arcs = dr.g.selectAll(".arc")
.data(data); .data(data);
arcs.enter().append("path") arcs.enter().append("path")
......
...@@ -2,19 +2,19 @@ ...@@ -2,19 +2,19 @@
* Renders geopoints as geo-json poly gon entities * Renders geopoints as geo-json poly gon entities
* Allows for them to clip on spheres correctly * Allows for them to clip on spheres correctly
*/ */
function displayGeopoints(scope, path) { function displayGeopoints(scope, dr, path) {
var points = []; var points = [];
var circle = d3.geo.circle(); var circle = d3.geo.circle();
var degrees = 180 / Math.PI var degrees = 180 / Math.PI
if (scope.panel.display.geopoints.enabled) { if (scope.panel.display.geopoints.enabled) {
points = scope.points; points = dr.points;
} }
var geopoints = scope.g.selectAll(".geopoint") var geopoints = dr.g.selectAll(".geopoint")
.data(points); .data(points);
geopoints.enter().append("path") geopoints.enter().append("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