Skip to content

Commit

Permalink
ENH: Update to newest Emperor API (#193)
Browse files Browse the repository at this point in the history
  • Loading branch information
ElDeveloper authored Jun 22, 2020
1 parent c672144 commit 1168b79
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions empress/support_files/js/selection-callback.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,26 @@ sPanel.fUpdateBtn.classList.remove("hidden");
legend.clearAllLegends();
empress.resetTree();

var colorGroups = {},
color;
for (var i = 0; i < samples.length; i++) {
color = samples[i].material.color.getHexString();
if (colorGroups[color] === undefined) {
colorGroups[color] = [];
}
colorGroups[color].push(samples[i].name);
// fetch a mapping of colors to plottable objects
var groups = view.groupByColor(samples);
var namesOnly = {};

// convert the array of plottable objects to just names
for (var key in groups) {
namesOnly[key] = groups[key].map(function (item) {
return item.name;
});
}
empress.colorSampleGroups(colorGroups);
empress.colorSampleGroups(namesOnly);

// 3 seconds before resetting
setTimeout(function () {
empress.resetTree();
empress.drawTree();

samples.forEach(function (sample) {
sample.material.emissive.set(0x000000);
});
for (var key in groups) {
view.setEmissive(0x000000, groups[key]);
}

plotView.needsUpdate = true;
}, 4000);

0 comments on commit 1168b79

Please sign in to comment.