@@ -402,9 +402,10 @@ class ProjectionsPanel extends LegacyElementMixin(PolymerElement) {
402402 this . customSelectedSearchByMetadataOption =
403403 this . searchByMetadataOptions [ Math . max ( 0 , searchByMetadataIndex ) ] ;
404404 }
405- public showTab ( id : ProjectionType ) {
406- this . currentProjection = id ;
407- const tab = this . $$ ( '.ink-tab[data-tab="' + id + '"]' ) as HTMLElement ;
405+ public showTab ( projection : ProjectionType ) {
406+ const tab = this . $$ (
407+ '.ink-tab[data-tab="' + projection + '"]'
408+ ) as HTMLElement ;
408409 const allTabs = this . root ?. querySelectorAll ( '.ink-tab' ) ;
409410 if ( allTabs ) {
410411 for ( let i = 0 ; i < allTabs . length ; i ++ ) {
@@ -419,7 +420,9 @@ class ProjectionsPanel extends LegacyElementMixin(PolymerElement) {
419420 }
420421 }
421422 util . classed (
422- this . $$ ( '.ink-panel-content[data-panel="' + id + '"]' ) as HTMLElement ,
423+ this . $$ (
424+ '.ink-panel-content[data-panel="' + projection + '"]'
425+ ) as HTMLElement ,
423426 'active' ,
424427 true
425428 ) ;
@@ -432,25 +435,29 @@ class ProjectionsPanel extends LegacyElementMixin(PolymerElement) {
432435 this . style . height = main . clientHeight + 'px' ;
433436 } ) ;
434437 }
435- this . beginProjection ( id ) ;
438+ this . beginProjection ( projection ) ;
436439 }
437440 private beginProjection ( projection : ProjectionType ) {
438441 if ( this . polymerChangesTriggerReprojection === false ) {
439442 return ;
440443 }
441- if ( projection === 'pca' ) {
444+ if ( this . currentProjection !== projection ) {
445+ this . currentProjection = projection ;
442446 if ( this . dataSet != null ) {
443- this . dataSet . stopTSNE ( ) ;
447+ if ( projection === 'tsne' ) {
448+ this . dataSet . tSNEShouldPause = false ;
449+ } else {
450+ this . dataSet . tSNEShouldPause = true ;
451+ }
444452 }
453+ }
454+ if ( projection === 'pca' ) {
445455 this . showPCA ( ) ;
446456 } else if ( projection === 'tsne' ) {
447457 this . showTSNE ( ) ;
448458 } else if ( projection === 'umap' ) {
449459 this . showUmap ( ) ;
450460 } else if ( projection === 'custom' ) {
451- if ( this . dataSet != null ) {
452- this . dataSet . stopTSNE ( ) ;
453- }
454461 this . computeAllCentroids ( ) ;
455462 this . reprojectCustom ( ) ;
456463 }
@@ -493,6 +500,7 @@ class ProjectionsPanel extends LegacyElementMixin(PolymerElement) {
493500 ( iteration : number ) => {
494501 if ( iteration != null ) {
495502 this . runTsneButton . disabled = false ;
503+ this . pauseTsneButton . innerText = 'Pause' ;
496504 this . pauseTsneButton . disabled = false ;
497505 this . iterationLabelTsne . innerText = '' + iteration ;
498506 this . projector . notifyProjectionPositionsUpdated ( ) ;
0 commit comments