From 7b4fb125b77d4b8671ea2908e98fd3d844944c9b Mon Sep 17 00:00:00 2001 From: Alon Levy Date: Mon, 10 Nov 2014 16:30:38 +0200 Subject: graph/textanalysis.ui: lastnode is now the last added node (fixes #124) --- scripts/textanalysis.ui.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'scripts/textanalysis.ui.js') 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('
' + "Chosen Type: " + nodetype + '
'); - RZ.graph.findCoordinates(lastnode, null); + RZ.graph.findCoordinates(id, null); } else { RZ.graph.editType(id, null, nodetype); $('.typeselection').html('
' + "Chosen Type: " + nodetype + '
'); - RZ.graph.findCoordinates(lastnode, null); + RZ.graph.findCoordinates(id, null); } RZ.graph.update(true); } -- cgit v1.3.1