Revert "Cache centroid"

Causes misplaced labels, suspect due to rounding artifacts.

This reverts commit 5344bdea26.
This commit is contained in:
John Firebaugh
2013-05-18 09:19:44 -07:00
parent 6045ffcfbe
commit 6c849baad6
2 changed files with 2 additions and 9 deletions
-8
View File
@@ -108,14 +108,6 @@ iD.Entity.prototype = {
});
},
// Returns the centroid of the area, in unprojected coordinates.
centroid: function(resolver) {
return resolver.transient(this, 'centroid', function() {
return iD.Entity.areaPath.projection().invert(
iD.Entity.areaPath.centroid(this.asGeoJSON(resolver, true)));
});
},
hasInterestingTags: function() {
return _.keys(this.tags).some(function(key) {
return key != 'attribution' &&
+2 -1
View File
@@ -362,7 +362,8 @@ iD.svg.Labels = function(projection, context) {
}
function getAreaLabel(entity, width, height) {
var centroid = projection(entity.centroid(graph)),
var path = d3.geo.path().projection(projection),
centroid = path.centroid(entity.asGeoJSON(graph, true)),
extent = entity.extent(graph),
entitywidth = projection(extent[1])[0] - projection(extent[0])[0],
rect;