summaryrefslogtreecommitdiff
path: root/scripts/textanalysis.ui.js
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/textanalysis.ui.js')
-rw-r--r--scripts/textanalysis.ui.js17
1 files changed, 10 insertions, 7 deletions
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);
}