diff options
| author | Alon Levy <alon@pobox.com> | 2015-03-07 22:06:29 +0200 |
|---|---|---|
| committer | Alon Levy <alon@pobox.com> | 2015-03-07 22:06:29 +0200 |
| commit | 51343360bad92228851c89454b077370e7499fbe (patch) | |
| tree | 89316f5a7df265d9892390996945d422de320c8e /src | |
| parent | 40c0be6f4e1c0f596462c990a35cee4bee4ff55a (diff) | |
client: fix phantom type now that we have 4 types and not 5. Fixes #362
Diffstat (limited to 'src')
| -rw-r--r-- | src/client/textanalysis.js | 5 | ||||
| -rw-r--r-- | src/client/textanalysis.ui.js | 7 |
2 files changed, 7 insertions, 5 deletions
diff --git a/src/client/textanalysis.js b/src/client/textanalysis.js index 682b0b54..d44dfd06 100644 --- a/src/client/textanalysis.js +++ b/src/client/textanalysis.js @@ -11,6 +11,7 @@ var separator_string = rz_config.separator_string; var typeindex = 0, nodetypes = model_types.nodetypes, + nodetypes_count = nodetypes.length, default_nodetype = 'person', node_name_to_type = {}; @@ -623,11 +624,11 @@ return { }, selected_type_next: function() { - typeindex = (typeindex + 1) % 5; + typeindex = (typeindex + 1) % nodetypes_count; return selectedType(); }, selected_type_prev: function() { - typeindex = (typeindex + 4) % 5; + typeindex = (typeindex + nodetypes_count - 1) % nodetypes_count; return selectedType(); } }; diff --git a/src/client/textanalysis.ui.js b/src/client/textanalysis.ui.js index 02ba8b0f..e5d3f314 100644 --- a/src/client/textanalysis.ui.js +++ b/src/client/textanalysis.ui.js @@ -108,7 +108,8 @@ function analyzeSentence(spec) input_bus.push({where: consts.INPUT_WHERE_TEXTANALYSIS, input: sentence}); } -function changeType(arg) { +function changeType(up) +{ var lastnode = textanalysis.lastnode(rz_core.edit_graph, input.selectionStart()), nodetype, id, @@ -120,7 +121,7 @@ function changeType(arg) { id = lastnode.id; name = lastnode.name; } - nodetype = (arg === 'up'? textanalysis.selected_type_next() : textanalysis.selected_type_prev()); + nodetype = (up ? textanalysis.selected_type_next() : textanalysis.selected_type_prev()); rz_core.edit_graph.editType(id, nodetype); typeselection.showChosenType(id, nodetype); @@ -138,7 +139,7 @@ var main = function () }); input.on_type.onValue(function (up) { if (textanalysis.lastnode(rz_core.edit_graph, input.selectionStart())) { - changeType(up ? "up" : "down"); + changeType(up); ret = false; } }); |
