@@ -425,12 +425,7 @@ function loadAll() {
425425 }
426426 } ) ;
427427
428- $ ( '#gene_color_order' ) . on ( 'focus' , function ( ) {
429- Object . keys ( state [ 'highlight-genes' ] ) . forEach ( gene_id => {
430- state [ 'highlight-genes' ] [ gene_id ] = $ ( '#picker_' + gene_id ) . attr ( 'color' ) ;
431- } ) ;
432-
433- } ) . change ( function ( ) {
428+ $ ( '#gene_color_order' ) . change ( function ( ) {
434429 state [ 'gene-fn-db' ] = $ ( this ) . val ( ) ;
435430 resetFunctionColors ( state [ $ ( this ) . val ( ) . toLowerCase ( ) + '-colors' ] ) ;
436431 redrawArrows ( ) ;
@@ -680,7 +675,7 @@ function generateFunctionColorTable(fn_colors, fn_type, highlight_genes=null, fi
680675 $ ( el ) . css ( 'background-color' , '#' + hex ) ;
681676 $ ( el ) . attr ( 'color' , '#' + hex ) ;
682677 let category = el . id . substring ( 7 ) . replaceAll ( '_' , ' ' ) ;
683- state [ $ ( '#gene_color_order' ) . val ( ) . toLowerCase ( ) + '-colors '] [ category ] = '#' + hex ;
678+ state [ 'highlight-genes '] [ category ] = '#' + hex ;
684679 if ( ! bySetColor ) $ ( el ) . val ( hex ) ;
685680 }
686681 } ) . keyup ( function ( ) {
@@ -749,8 +744,8 @@ function addGeneIDColor(gene_id, color="#FF0000") {
749744 onChange : function ( hsb , hex , rgb , el , bySetColor ) {
750745 $ ( el ) . css ( 'background-color' , '#' + hex ) ;
751746 $ ( el ) . attr ( 'color' , '#' + hex ) ;
752-
753- state [ 'highlight-genes' ] [ el . id . substring ( 7 ) ] = '#' + hex ;
747+ let category = el . id . substring ( 7 ) . replaceAll ( '_' , ' ' ) ;
748+ state [ 'highlight-genes' ] [ category ] = '#' + hex ;
754749 if ( ! bySetColor ) $ ( el ) . val ( hex ) ;
755750 }
756751 } ) . keyup ( function ( ) {
@@ -795,8 +790,14 @@ function defineArrowMarkers(fn_type, cags=null, noneMarker=true) {
795790 if ( category . indexOf ( ',' ) != - 1 ) category = category . substr ( 0 , category . indexOf ( ',' ) ) ;
796791 if ( category . indexOf ( ';' ) != - 1 ) category = category . substr ( 0 , category . indexOf ( ';' ) ) ;
797792 if ( category . indexOf ( '!!!' ) != - 1 ) category = category . substr ( 0 , category . indexOf ( '!!!' ) ) ;
798- let prop = fn_type . toLowerCase ( ) + '-colors' ;
799- let color = state [ prop ] [ category ] ? state [ prop ] [ category ] : "#808080" ;
793+ let color ;
794+ if ( fn_type ) {
795+ let prop = fn_type . toLowerCase ( ) + '-colors' ;
796+ color = state [ prop ] [ category ] ? state [ prop ] [ category ] : "#808080" ;
797+ } else {
798+ // highlighted gene id
799+ color = state [ 'highlight-genes' ] [ category ] ;
800+ }
800801 contextSvg . select ( '#contextSvgDefs' ) . append ( 'svg:marker' )
801802 . attr ( 'id' , 'arrow_' + getCleanCagCode ( category ) )
802803 . attr ( 'markerHeight' , 2 )
0 commit comments