Skip to content

Commit

Permalink
Fixed bug with channel traces and window resize
Browse files Browse the repository at this point in the history
  • Loading branch information
nchuynh committed Dec 4, 2023
1 parent b0b0cbf commit ba12022
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
13 changes: 6 additions & 7 deletions minerva_analysis/client/src/js/views/channelList.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ class ChannelList {
this.eventHandler = eventHandler;
this.dataLayer = dataLayer;
this.selections = [];
this.hasChannelGMM = {};
this.ranges = {};
this.sliders = new Map();
this.image_channels = {};
this.sel = {};
this.currentChannels = {};
this.rangeConnector = {};
this.colorConnector = {};
this.hasChannelGMM = [];
this.channelIDs = {};
this.createColorPicker();
this.container = d3.select("#channel_list");
Expand Down Expand Up @@ -70,8 +70,6 @@ class ChannelList {
* @param name - the channel to set and display as selected
*/
selectChannel(name) {
this.getAndDrawChannelGMM(name)

let fullName = this.dataLayer.getFullChannelName(name);
let channelIdx = imageChannels[fullName];
let channelID = this.channelIDs[name];
Expand Down Expand Up @@ -692,10 +690,11 @@ class ChannelList {
* on window resize we re-initialize (this should be better handled with an update pattern)
*/
window.addEventListener("resize", function () {
const { channelList } = __minervaAnalysis;
const { channelList } = __minervaAnalysis;
if (typeof channelList != "undefined" && channelList) {
channelList.sliders.forEach((slider, name) => {
d3.select('div#channel-slider_' + name).select('svg').remove();
channelList.sliders.forEach((slider, name) => {
let channelID = channelList.channelIDs[name]
d3.select('div#channel-slider_' + channelID).select('svg').remove();
const channelListEl = document.getElementById("channel_list");
if (channelListEl) {
const swidth = channelListEl.getBoundingClientRect().width;
Expand All @@ -704,7 +703,7 @@ window.addEventListener("resize", function () {
channelList.drawChannelGMM(name);
}
}
});
});
}
});

Expand Down
3 changes: 2 additions & 1 deletion minerva_analysis/client/src/js/views/csvGatingList.js
Original file line number Diff line number Diff line change
Expand Up @@ -857,7 +857,8 @@ window.addEventListener("resize", () => {
const { csv_gatingList } = __minervaAnalysis;
if (typeof csv_gatingList != "undefined" && csv_gatingList) {
csv_gatingList.sliders.forEach((slider, name) => {
d3.select('div#csv_gating-slider_' + name).select('svg').remove();
let gatingID = csv_gatingList.gatingIDs[name]
d3.select('div#csv_gating-slider_' + gatingID).select('svg').remove();
let fullName = csv_gatingList.dataLayer.getFullChannelName(name);
let sliderRange = [csv_gatingList.databaseDescription[fullName].min, csv_gatingList.databaseDescription[fullName].max];
const gatingListEl = document.getElementById("csv_gating_list");
Expand Down

0 comments on commit ba12022

Please sign in to comment.