Skip to content

Commit

Permalink
simulate topic click whenever topic is changed via topic input widget
Browse files Browse the repository at this point in the history
  • Loading branch information
crew102 committed Apr 23, 2018
1 parent ba04fc3 commit 04c87ee
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions inst/htmljs/ldavis.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,11 @@ LDAvis = function(to_select, json_file) {
// increment the value in the input box
document.getElementById(topicID).value = value_new;
topic_off(document.getElementById(topicID + value_old));
topic_on(document.getElementById(topicID + value_new));
var oldtopic = document.getElementById(topicID + value_new);
topic_on(oldtopic);
vis_state.topic = value_new;
state_save(true);
topic_clic(oldtopic, value_new);
})

d3.select("#" + topicDown)
Expand All @@ -188,9 +190,11 @@ LDAvis = function(to_select, json_file) {
// increment the value in the input box
document.getElementById(topicID).value = value_new;
topic_off(document.getElementById(topicID + value_old));
topic_on(document.getElementById(topicID + value_new));
var oldtopic = document.getElementById(topicID + value_new);
topic_on(oldtopic);
vis_state.topic = value_new;
state_save(true);
topic_clic(oldtopic, value_new);
})

d3.select("#" + topicID)
Expand All @@ -203,10 +207,12 @@ LDAvis = function(to_select, json_file) {
var value_new = document.getElementById(topicID).value;
if (!isNaN(value_new) && value_new > 0) {
value_new = Math.min(K, Math.max(1, value_new))
topic_on(document.getElementById(topicID + value_new));
var oldtopic = document.getElementById(topicID + value_new);
topic_on(oldtopic);
vis_state.topic = value_new;
state_save(true);
document.getElementById(topicID).value = vis_state.topic;
topic_clic(oldtopic, value_new);
}
})

Expand Down

0 comments on commit 04c87ee

Please sign in to comment.