From 844c11df63c93b28d89c05e32eff7aa2d84246c7 Mon Sep 17 00:00:00 2001 From: John Firebaugh Date: Wed, 25 Sep 2013 14:46:12 -0700 Subject: [PATCH] Clean up --- js/id/renderer/gpx_layer.js | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/js/id/renderer/gpx_layer.js b/js/id/renderer/gpx_layer.js index 379557a76..f44c38d94 100644 --- a/js/id/renderer/gpx_layer.js +++ b/js/id/renderer/gpx_layer.js @@ -22,9 +22,12 @@ iD.GpxLayer = function(context, dispatch) { .append('path') .attr('class', 'gpx'); + var path = d3.geo.path() + .projection(projection); + paths - .attr('d', d3.geo.path().projection(projection)); - + .attr('d', path); + if (typeof gj.features !== 'undefined') { svg .selectAll('text') @@ -33,21 +36,19 @@ iD.GpxLayer = function(context, dispatch) { svg .selectAll('path') .data(gj.features) - .enter() + .enter() .append('text') .attr('class', 'gpx') .text(function(d) { return d.properties.name; }) .attr('x', function(d) { - var centroid = d3.geo.path().projection(projection) - .centroid(d); - return centroid[0] + 5; + var centroid = path.centroid(d); + return centroid[0] + 5; }) .attr('y', function(d) { - var centroid = d3.geo.path().projection(projection) - .centroid(d); - return centroid[1]; + var centroid = path.centroid(d); + return centroid[1]; }); } }