mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-16 05:49:16 +02:00
Cache isIntersection
This commit is contained in:
@@ -23,6 +23,14 @@ _.extend(iD.Node.prototype, {
|
||||
return this.update({loc: loc});
|
||||
},
|
||||
|
||||
isIntersection: function(resolver) {
|
||||
return resolver.transient(this, 'isIntersection', function() {
|
||||
return resolver.parentWays(this).filter(function(parent) {
|
||||
return parent.geometry(resolver) === 'line';
|
||||
}).length > 1;
|
||||
});
|
||||
},
|
||||
|
||||
asJXON: function(changeset_id) {
|
||||
var r = {
|
||||
node: {
|
||||
|
||||
@@ -48,12 +48,6 @@ iD.svg.Vertices = function(projection, context) {
|
||||
return vertices;
|
||||
}
|
||||
|
||||
function isIntersection(entity, graph) {
|
||||
return graph.parentWays(entity).filter(function (parent) {
|
||||
return parent.geometry(graph) === 'line';
|
||||
}).length > 1;
|
||||
}
|
||||
|
||||
function draw(groups, vertices, klass, graph, zoom) {
|
||||
groups = groups.data(vertices, function(entity) {
|
||||
return iD.Entity.key(entity) + ',' + zoom;
|
||||
@@ -129,7 +123,7 @@ iD.svg.Vertices = function(projection, context) {
|
||||
|
||||
if (entity.id in selected ||
|
||||
entity.hasInterestingTags() ||
|
||||
isIntersection(entity, graph)) {
|
||||
entity.isIntersection(graph)) {
|
||||
vertices.push(entity)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user