diff options
| author | Alon Levy <alon@pobox.com> | 2014-10-22 10:08:23 +0300 |
|---|---|---|
| committer | Alon Levy <alon@pobox.com> | 2014-10-24 12:44:44 +0300 |
| commit | d1b2b184dd7747b21eb5f69439f2a4dd5c271cf7 (patch) | |
| tree | b143ec922d6a20dd2f59714735a09febbf4f0f7e /scripts/textanalysis.ui.js | |
| parent | 1cda178609e6946b6791fe2dd7c6af7a151f2eb4 (diff) | |
fixes #106
broken by define addition (require.js)
Diffstat (limited to 'scripts/textanalysis.ui.js')
| -rw-r--r-- | scripts/textanalysis.ui.js | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/scripts/textanalysis.ui.js b/scripts/textanalysis.ui.js index 0a1e3ece..69f2e675 100644 --- a/scripts/textanalysis.ui.js +++ b/scripts/textanalysis.ui.js @@ -38,22 +38,24 @@ function textSelect(inp, s, e) { } function changeType(arg, id) { + var typeindex; + var lastnode = textanalysis.lastnode(); + var nodetype; + if(!id) { id = "new node"; } + typeindex = (arg === 'up'? textanalysis.typeindex_next() : textanalysis.typeindex_prev()); + nodetype = textanalysis.nodetypes()[typeindex]; + if (arg === 'up') { - if (typeindex < 4) typeindex++; - else typeindex = 0; - RZ.graph.editType(id, null, nodetypes[typeindex]); - $('.typeselection').html('<table><tr><td style="height:28px"></td></tr><tr><td>' + "Chosen Type: " + nodetypes[typeindex] + '</td></tr></table>'); - RZ.graph.findCoordinates(lastnode,null); + 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); } else { - if (typeindex > 0) typeindex--; - else typeindex = 4; - - RZ.graph.editType(id, null, nodetypes[typeindex]); - $('.typeselection').html('<table><tr><td style="height:28px"></td></tr><tr><td>' + "Chosen Type: " + nodetypes[typeindex] + '</td></tr></table>'); - RZ.graph.findCoordinates(lastnode,null); + 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.update(true); } @@ -78,7 +80,7 @@ return { } if (e.keyCode == 9) {//TAB e.preventDefault(); - changeType("down", lastnode); + changeType("down", textanalysis.lastnode()); return false; } |
