Skip to content

Commit

Permalink
Embedding Projector: fix switching projections
Browse files Browse the repository at this point in the history
  • Loading branch information
alicialics committed Apr 4, 2023
1 parent e5d1771 commit cb0e399
Showing 1 changed file with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,6 @@ class ProjectionsPanel extends LegacyElementMixin(PolymerElement) {
this.searchByMetadataOptions[Math.max(0, searchByMetadataIndex)];
}
public showTab(id: ProjectionType) {
this.currentProjection = id;
const tab = this.$$('.ink-tab[data-tab="' + id + '"]') as HTMLElement;
const allTabs = this.root?.querySelectorAll('.ink-tab');
if (allTabs) {
Expand Down Expand Up @@ -434,19 +433,23 @@ class ProjectionsPanel extends LegacyElementMixin(PolymerElement) {
if (this.polymerChangesTriggerReprojection === false) {
return;
}
if (projection === 'pca') {
if (this.currentProjection !== projection) {
this.currentProjection = projection;
if (this.dataSet != null) {
this.dataSet.stopTSNE();
if (projection === 'tsne') {
this.dataSet.tSNEShouldPause = false;
} else {
this.dataSet.tSNEShouldPause = true;
}
}
}
if (projection === 'pca') {
this.showPCA();
} else if (projection === 'tsne') {
this.showTSNE();
} else if (projection === 'umap') {
this.showUmap();
} else if (projection === 'custom') {
if (this.dataSet != null) {
this.dataSet.stopTSNE();
}
this.computeAllCentroids();
this.reprojectCustom();
}
Expand Down Expand Up @@ -489,6 +492,7 @@ class ProjectionsPanel extends LegacyElementMixin(PolymerElement) {
(iteration: number) => {
if (iteration != null) {
this.runTsneButton.disabled = false;
this.pauseTsneButton.innerText = 'Pause';
this.pauseTsneButton.disabled = false;
this.iterationLabelTsne.innerText = '' + iteration;
this.projector.notifyProjectionPositionsUpdated();
Expand Down

0 comments on commit cb0e399

Please sign in to comment.