From 25c80311c1325d0a33019e451c925411430bdf5b Mon Sep 17 00:00:00 2001 From: Tom MacWright Date: Wed, 14 Nov 2012 16:21:45 -0500 Subject: [PATCH] Simpler, faster line generation. --- js/iD/renderer/Map.js | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/js/iD/renderer/Map.js b/js/iD/renderer/Map.js index c4df01d60..e203f9190 100755 --- a/js/iD/renderer/Map.js +++ b/js/iD/renderer/Map.js @@ -54,18 +54,8 @@ iD.Map = function(elem) { .on('dragend', function() { map.update(); }), - // geo - linegen = d3.svg.line() - .x(function(d) { - return projection(ll2a(d))[0]; - }) - .y(function(d) { - return projection(ll2a(d))[1]; - }), - // Abstract linegen so that it pulls from `.children`. This - // makes it possible to call simply `.attr('d', nodeline)`. nodeline = function(d) { - return linegen(d.nodes); + return 'M' + d.nodes.map(ll2a).map(projection).join('L'); }, key = function(d) { return d.id; }; @@ -162,7 +152,7 @@ iD.Map = function(elem) { .attr('class', class_area) .classed('active', classActive) .on('click', selectClick); - fills.attr('d', nodeline); + fills.attr('d', function(d) { return d._line; }); if (changed) { fills .attr('class', class_area) @@ -285,7 +275,7 @@ iD.Map = function(elem) { projection .translate(d3.event.translate) .scale(d3.event.scale); - d3.timer(redraw, 0); + redraw(); download(); }