From 9557d8f130fd8f5807fff2f705ad0331687ec98e Mon Sep 17 00:00:00 2001 From: John Firebaugh Date: Thu, 17 Oct 2013 10:19:56 -0400 Subject: [PATCH] Cache path --- js/id/svg/labels.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/id/svg/labels.js b/js/id/svg/labels.js index ac558179c..da2a2ee1d 100644 --- a/js/id/svg/labels.js +++ b/js/id/svg/labels.js @@ -1,4 +1,5 @@ iD.svg.Labels = function(projection, context) { + var path = d3.geo.path().projection(projection); // Replace with dict and iterate over entities tags instead? var label_stack = [ @@ -368,8 +369,7 @@ iD.svg.Labels = function(projection, context) { } function getAreaLabel(entity, width, height) { - var path = d3.geo.path().projection(projection), - centroid = path.centroid(entity.asGeoJSON(graph, true)), + var centroid = path.centroid(entity.asGeoJSON(graph, true)), extent = entity.extent(graph), entitywidth = projection(extent[1])[0] - projection(extent[0])[0], rect;