Cache path

This commit is contained in:
John Firebaugh
2013-10-17 10:19:56 -04:00
parent 26e38d7f8f
commit 9557d8f130
+2 -2
View File
@@ -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;