@@ -494,16 +494,16 @@ RelChartBuilder.prototype.correlateHighlights = function(doc, relToGx, imgToGx)
494
494
return reversedMap ;
495
495
}
496
496
497
- function highlight ( elements , myElement , elementsClass , myClass ) {
498
- if ( ! isEmpty ( this . relChart . highlightsToProcess ) ) {
497
+ function highlight ( relChart , elements , myElement , elementsClass , myClass ) {
498
+ if ( ! isEmpty ( relChart . highlightsToProcess ) ) {
499
499
// Image viewer highlight elements don't exist when the graph is first being built, so wait until the first highlight is
500
500
// done before triggering that.
501
- for ( let h of this . relChart . highlightsToProcess ) {
501
+ for ( let h of relChart . highlightsToProcess ) {
502
502
$ ( "#" + h . imgElement ) . hover (
503
- function ( ) { h ( h . relElements , h . imgElement , "record-highlight" , null ) ; } ,
503
+ function ( ) { highlight ( relChart , h . relElements , h . imgElement , "record-highlight" , null ) ; } ,
504
504
function ( ) { unhighlight ( h . relElements , h . imgElement , "record-highlight" , null ) ; } ) ;
505
505
}
506
- this . relChart . highlightsToProcess = [ ] ; // now handled, so clear it.
506
+ relChart . highlightsToProcess = [ ] ; // now handled, so clear it.
507
507
}
508
508
if ( elements ) {
509
509
for ( let element of elements ) {
@@ -554,7 +554,7 @@ RelChartBuilder.prototype.correlateHighlights = function(doc, relToGx, imgToGx)
554
554
else {
555
555
let relElements = gxToRel [ gxId ] ;
556
556
if ( ! empty ( relElements ) ) {
557
- highlightsToProcess . push ( { imgElement : imgElement , relElements : relElements } ) ;
557
+ this . relChart . highlightsToProcess . push ( { imgElement : imgElement , relElements : relElements } ) ;
558
558
// Add this imgElement to the list of imgElements associated with each of these relElements, so
559
559
// we can do highlighting in the reverse direction.
560
560
for ( let relElement of relElements ) {
@@ -575,9 +575,10 @@ RelChartBuilder.prototype.correlateHighlights = function(doc, relToGx, imgToGx)
575
575
for ( let relElement in relToImg ) {
576
576
if ( relToImg . hasOwnProperty ( relElement ) ) {
577
577
let imgElements = relToImg [ relElement ] ;
578
+ let relChart = this . relChart ;
578
579
if ( ! empty ( imgElements ) ) {
579
580
$ ( "#" + relElement ) . hover (
580
- function ( ) { highlight ( imgElements , relElement , "img-highlight" , "record-highlight" ) ; } ,
581
+ function ( ) { highlight ( relChart , imgElements , relElement , "img-highlight" , "record-highlight" ) ; } ,
581
582
function ( ) { unhighlight ( imgElements , relElement , "img-highlight" , "record-highlight" ) ; } ) ;
582
583
}
583
584
}
0 commit comments