mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-19 23:14:47 +02:00
Cache area
This commit is contained in:
@@ -95,6 +95,12 @@ iD.Entity.prototype = {
|
||||
return this.extent(resolver).intersects(extent);
|
||||
},
|
||||
|
||||
area: function(resolver, path) {
|
||||
return resolver.transient(this, 'area', function() {
|
||||
return path.area(this);
|
||||
});
|
||||
},
|
||||
|
||||
hasInterestingTags: function() {
|
||||
return _.keys(this.tags).some(function(key) {
|
||||
return key != 'attribution' &&
|
||||
|
||||
+2
-2
@@ -37,12 +37,12 @@ iD.svg.Areas = function(projection) {
|
||||
if (multipolygon = iD.geo.isSimpleMultipolygonOuterMember(entity, graph)) {
|
||||
areas[multipolygon.id] = {
|
||||
entity: multipolygon.mergeTags(entity.tags),
|
||||
area: Math.abs(path.area(entity))
|
||||
area: Math.abs(entity.area(graph, path))
|
||||
};
|
||||
} else if (!areas[entity.id]) {
|
||||
areas[entity.id] = {
|
||||
entity: entity,
|
||||
area: Math.abs(path.area(entity))
|
||||
area: Math.abs(entity.area(graph, path))
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user