mirror of
https://github.com/FoggedLens/iD.git
synced 2026-03-21 18:43:23 +00:00
Don't call childNodes unless necessary (avoid extra _childNodes caching)
`hasHiddenConnections` was calling it for all features, inluding points and vertices, causing _childNodes to have a lot of unnecessary keys added to it.
This commit is contained in:
@@ -81,14 +81,12 @@ iD.Graph.prototype = {
|
||||
},
|
||||
|
||||
childNodes: function(entity) {
|
||||
if (this._childNodes[entity.id])
|
||||
return this._childNodes[entity.id];
|
||||
if (this._childNodes[entity.id]) return this._childNodes[entity.id];
|
||||
if (!entity.nodes) return [];
|
||||
|
||||
var nodes = [];
|
||||
if (entity.nodes) {
|
||||
for (var i = 0; i < entity.nodes.length; i++) {
|
||||
nodes[i] = this.entity(entity.nodes[i]);
|
||||
}
|
||||
for (var i = 0; i < entity.nodes.length; i++) {
|
||||
nodes[i] = this.entity(entity.nodes[i]);
|
||||
}
|
||||
|
||||
if (iD.debug) Object.freeze(nodes);
|
||||
|
||||
@@ -378,7 +378,7 @@ iD.Features = function(context) {
|
||||
childNodes = [resolver.entity(entity.edge[0]), resolver.entity(entity.edge[1])];
|
||||
connections = [];
|
||||
} else {
|
||||
childNodes = resolver.childNodes(entity);
|
||||
childNodes = entity.nodes ? resolver.childNodes(entity) : [];
|
||||
connections = features.getParents(entity, resolver, entity.geometry(resolver));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user