diff --git a/empress/support_files/js/node-click-callback.js b/empress/support_files/js/node-click-callback.js index 6a2462d15..d525aea0e 100644 --- a/empress/support_files/js/node-click-callback.js +++ b/empress/support_files/js/node-click-callback.js @@ -22,3 +22,41 @@ ec.sceneViews[0].on("click", function (name, object) { empress.showNodeMenuForName(name); }); + +ec.controllers.color.addEventListener("value-double-clicked", function ( + payload +) { + // when dealing with a biplot ignore arrow-emitted events + if (payload.target.decompositionName() !== "scatter") { + return; + } + + // cancel any ongoing timers + clearTimeout(empress.timer); + + // reset emissive settings for all markers since an ongoing timer may have + // been cancelled + ec.decViews.scatter.setEmissive(0x000000); + plotView.needsUpdate = true; + + // if there's any coloring setup remove it, and re-enable the update button + sPanel.sUpdateBtn.classList.remove("hidden"); + sPanel.fUpdateBtn.classList.remove("hidden"); + legend.clear(); + empress.resetTree(); + + var names = _.map(payload.message.group, function (item) { + return item.name; + }); + var container = {}; + container[payload.message.attribute] = names; + empress.colorSampleGroups(container); + + // 4 seconds before resetting + empress.timer = setTimeout(function () { + empress.resetTree(); + empress.drawTree(); + + plotView.needsUpdate = true; + }, 4000); +}); diff --git a/empress/support_files/js/selection-callback.js b/empress/support_files/js/selection-callback.js index 331c76e2d..ac7af94d9 100644 --- a/empress/support_files/js/selection-callback.js +++ b/empress/support_files/js/selection-callback.js @@ -4,6 +4,9 @@ * */ +// cancel any ongoing timers +clearTimeout(empress.timer); + // if there's any coloring setup remove it, and re-enable the update button sPanel.sUpdateBtn.classList.remove("hidden"); sPanel.fUpdateBtn.classList.remove("hidden"); @@ -22,8 +25,8 @@ for (var key in groups) { } empress.colorSampleGroups(namesOnly); -// 3 seconds before resetting -setTimeout(function () { +// 4 seconds before resetting +empress.timer = setTimeout(function () { empress.resetTree(); empress.drawTree();