summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--scripts/textanalysis.js8
-rw-r--r--scripts/textanalysis.ui.js17
2 files changed, 14 insertions, 11 deletions
diff --git a/scripts/textanalysis.js b/scripts/textanalysis.js
index e911adf6..4394a93f 100644
--- a/scripts/textanalysis.js
+++ b/scripts/textanalysis.js
@@ -362,9 +362,6 @@ var textAnalyser = function (newtext, finalize) {
ret.drop_conjugator_links = and_count < linkindex;
- //FOR THE EXTERNAL ARROW-TYPE CHANGER
- lastnode = newnodes[nodeindex];
-
ret.applyToGraph = function(graph, backend_commit) {
window.ret = ret;
var comp = graph.compareSubset('temp',
@@ -398,7 +395,7 @@ var textAnalyser = function (newtext, finalize) {
if (n.state == 'temp' && finalize) {
console.log('bug: temp node creation on finalize');
} else {
- graph.addNode(n.name, n.type, n.state);
+ lastnode = graph.addNode(n.name, n.type, n.state);
}
}
for (k in ret.links) {
@@ -436,7 +433,10 @@ return {
autoSuggestAddName:autoSuggestAddName,
ANALYSIS_NODE_START:ANALYSIS_NODE_START,
ANALYSIS_LINK:ANALYSIS_LINK,
+
+ //for the external arrow-type changer
lastnode: function() { return lastnode; },
+
typeindex: function() { return typeindex; },
typeindex_next: function() {
typeindex = (typeindex + 1) % 5;
diff --git a/scripts/textanalysis.ui.js b/scripts/textanalysis.ui.js
index 946ce0d5..4c11fc84 100644
--- a/scripts/textanalysis.ui.js
+++ b/scripts/textanalysis.ui.js
@@ -45,13 +45,16 @@ function textSelect(inp, s, e) {
}
}
-function changeType(arg, id) {
- var typeindex;
- var lastnode = textanalysis.lastnode();
- var nodetype;
+function changeType(arg) {
+ var typeindex,
+ lastnode = textanalysis.lastnode(),
+ nodetype,
+ id;
- if(!id) {
+ if(!lastnode) {
id = "new node";
+ } else {
+ id = lastnode.id;
}
typeindex = (arg === 'up'? textanalysis.typeindex_next() : textanalysis.typeindex_prev());
nodetype = textanalysis.nodetypes()[typeindex];
@@ -59,11 +62,11 @@ function changeType(arg, id) {
if (arg === 'up') {
RZ.graph.editType(id, null, nodetype);
$('.typeselection').html('<table><tr><td style="height:28px"></td></tr><tr><td>' + "Chosen Type: " + nodetype + '</td></tr></table>');
- RZ.graph.findCoordinates(lastnode, null);
+ RZ.graph.findCoordinates(id, null);
} else {
RZ.graph.editType(id, null, nodetype);
$('.typeselection').html('<table><tr><td style="height:28px"></td></tr><tr><td>' + "Chosen Type: " + nodetype + '</td></tr></table>');
- RZ.graph.findCoordinates(lastnode, null);
+ RZ.graph.findCoordinates(id, null);
}
RZ.graph.update(true);
}