diff options
| author | Alon Levy <alon@pobox.com> | 2014-11-25 20:55:46 +0200 |
|---|---|---|
| committer | Alon Levy <alon@pobox.com> | 2014-11-25 20:55:48 +0200 |
| commit | fd32d488fa0a2d8e35d8119fad78b4c81304ba5d (patch) | |
| tree | e3eb1c1ce471b1f1e45dd5f0411c8ff350d12259 /src | |
| parent | ac1ef7be34de556a4bb972a28ade77444f543e5b (diff) | |
graph/__addNode: fix to handle same node reference
It now returns a node, either a new one or the existing one. This is
used by addNode and further up to get the existing (regressed until this
patch from the breaking patch) behavior of expanding existing nodes with
new links.
Diffstat (limited to 'src')
| -rw-r--r-- | src/model/graph.js | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/model/graph.js b/src/model/graph.js index e2c1b9d1..3fefc6c7 100644 --- a/src/model/graph.js +++ b/src/model/graph.js @@ -34,10 +34,8 @@ function Graph() { if (undefined == spec.id) { existing_node = findNodeByName(spec.name) if (existing_node){ - // FIXME handle node-with-equal-name case - console.debug('__addNode: name collision: existing-node.name: \'' + existing_node.name + '\'' + 'new-node.name: \'' + spec.name + '\''); - return; - }else{ + return existing_node; + } else { node = model_core.create_node__set_random_id(spec); if (debug) { if ('bubble' == node.type){ @@ -53,8 +51,8 @@ function Graph() { existing_node = findNode(node.id, null); if (existing_node) { - console.debug('__addNode: id collision: existing-node.id: \'' + existing_node.id + '\' ' + 'new-node.id: \'' + node.id + '\''); - return; + console.debug('__addNode: id collision: existing-node.id: \'' + existing_node.id + '\', ' + 'new-node.id: \'' + node.id + '\''); + return existing_node; } undefined === notify && (notify = true); // notify by default |
