diff options
| -rw-r--r-- | scripts/rhizicore.js | 16 | ||||
| -rw-r--r-- | scripts/textanalysis.js | 9 |
2 files changed, 19 insertions, 6 deletions
diff --git a/scripts/rhizicore.js b/scripts/rhizicore.js index 8ba19bc2..7e107697 100644 --- a/scripts/rhizicore.js +++ b/scripts/rhizicore.js @@ -226,7 +226,10 @@ function myGraph(el) { if (drop_conjugator_links && name && (name.replace(/ /g,"") === "and")) { state = "temp"; } - if(!found && ((sourceNode !== undefined) && (targetNode !== undefined))) { + if (sourceNode === undefined || targetNode === undefined) { + return; + } + if (!found) { var link = { "source": sourceNode, "target": targetNode, @@ -237,15 +240,20 @@ function myGraph(el) { if (this.history !== undefined) { this.history.record_links([link]); } + } else { + found.name = name; + found.state = state; } } - this.editLink = function(sourceId, targetId, newname) { + this.editLink = function(sourceId, targetId, newname, newstate) { var link = findLink(sourceId, targetId, newname); if (link !== undefined) { link.name = newname; - - } else {} + if (newstate !== undefined) { + link.state = newstate; + } + } } this.editLinkTarget = function(sourceId, targetId, newTarget) { diff --git a/scripts/textanalysis.js b/scripts/textanalysis.js index 74b029ae..5003b110 100644 --- a/scripts/textanalysis.js +++ b/scripts/textanalysis.js @@ -325,11 +325,16 @@ var textAnalyser2 = function (newtext, finalize) { return [link.sourceId.toLowerCase(), link.targetId.toLowerCase()]; } )); - var k, n; + var k, n, l; if (comp.graph_same && !finalize) { + console.log('same graph, changing graph just a bit'); if (comp.old_id && comp.new_id) { graph.editName(comp.old_id, null, comp.new_id); } + for (k in ret.links) { + l = ret.links[k]; + graph.addLink(l.sourceId, l.targetId, l.name, l.state, ret.drop_conjugator_links); + } } else { //REINITIALISE GRAPH (DUMB BUT IT WORKS) graph.removeNodes("temp"); @@ -339,7 +344,7 @@ var textAnalyser2 = function (newtext, finalize) { graph.addNode(n.id, n.type, n.state); } for (k in ret.links) { - var l = ret.links[k]; + l = ret.links[k]; graph.addLink(l.sourceId, l.targetId, l.name, l.state, ret.drop_conjugator_links); } } |
