@@ -772,12 +772,9 @@ function _hover(gd, evt, subplot, noHoverEvent) {
772772 hoverdistance : fullLayout . hoverdistance
773773 } ;
774774
775- var actualHoverData = hoverData . filter ( function ( d ) {
776- return d . hoverinfo !== 'none' ;
777- } ) ;
778- var hoverLabels = actualHoverData . length && createHoverText ( actualHoverData , labelOpts , gd ) ;
775+ var hoverLabels = createHoverText ( hoverData , labelOpts , gd ) ;
779776
780- if ( hoverLabels && ! helpers . isUnifiedHover ( hovermode ) ) {
777+ if ( ! helpers . isUnifiedHover ( hovermode ) ) {
781778 hoverAvoidOverlaps ( hoverLabels , rotateLabels ? 'xa' : 'ya' , fullLayout ) ;
782779 alignHoverText ( hoverLabels , rotateLabels , fullLayout . _invScaleX , fullLayout . _invScaleY ) ;
783780 } // TODO: tagName hack is needed to appease geo.js's hack of using evt.target=true
@@ -1025,14 +1022,11 @@ function createHoverText(hoverData, opts, gd) {
10251022
10261023 // Show a single hover label
10271024 if ( helpers . isUnifiedHover ( hovermode ) ) {
1028- var unifiedHoverData = hoverData . filter ( function ( d ) {
1029- return d . hoverinfo !== 'none' ;
1030- } ) ;
10311025 // Delete leftover hover labels from other hovermodes
10321026 container . selectAll ( 'g.hovertext' ) . remove ( ) ;
10331027
10341028 // Return early if nothing is hovered on
1035- if ( unifiedHoverData . length === 0 ) return ;
1029+ if ( hoverData . length === 0 ) return ;
10361030
10371031 // mock legend
10381032 var mockLayoutIn = {
@@ -1054,11 +1048,11 @@ function createHoverText(hoverData, opts, gd) {
10541048
10551049 // prepare items for the legend
10561050 mockLegend . entries = [ ] ;
1057- for ( var j = 0 ; j < unifiedHoverData . length ; j ++ ) {
1058- var texts = getHoverLabelText ( unifiedHoverData [ j ] , true , hovermode , fullLayout , t0 ) ;
1051+ for ( var j = 0 ; j < hoverData . length ; j ++ ) {
1052+ var texts = getHoverLabelText ( hoverData [ j ] , true , hovermode , fullLayout , t0 ) ;
10591053 var text = texts [ 0 ] ;
10601054 var name = texts [ 1 ] ;
1061- var pt = unifiedHoverData [ j ] ;
1055+ var pt = hoverData [ j ] ;
10621056 pt . name = name ;
10631057 if ( name !== '' ) {
10641058 pt . text = name + ' : ' + text ;
@@ -1093,7 +1087,7 @@ function createHoverText(hoverData, opts, gd) {
10931087 var tbb = legendContainer . node ( ) . getBoundingClientRect ( ) ;
10941088 var tWidth = tbb . width + 2 * HOVERTEXTPAD ;
10951089 var tHeight = tbb . height + 2 * HOVERTEXTPAD ;
1096- var winningPoint = unifiedHoverData [ 0 ] ;
1090+ var winningPoint = hoverData [ 0 ] ;
10971091 var avgX = ( winningPoint . x0 + winningPoint . x1 ) / 2 ;
10981092 var avgY = ( winningPoint . y0 + winningPoint . y1 ) / 2 ;
10991093 // When a scatter (or e.g. heatmap) point wins, it's OK for the hovelabel to occlude the bar and other points.
@@ -1108,11 +1102,11 @@ function createHoverText(hoverData, opts, gd) {
11081102 lyTop = avgY - HOVERTEXTPAD ;
11091103 lyBottom = avgY + HOVERTEXTPAD ;
11101104 } else {
1111- lyTop = Math . min . apply ( null , unifiedHoverData . map ( function ( c ) { return Math . min ( c . y0 , c . y1 ) ; } ) ) ;
1112- lyBottom = Math . max . apply ( null , unifiedHoverData . map ( function ( c ) { return Math . max ( c . y0 , c . y1 ) ; } ) ) ;
1105+ lyTop = Math . min . apply ( null , hoverData . map ( function ( c ) { return Math . min ( c . y0 , c . y1 ) ; } ) ) ;
1106+ lyBottom = Math . max . apply ( null , hoverData . map ( function ( c ) { return Math . max ( c . y0 , c . y1 ) ; } ) ) ;
11131107 }
11141108 } else {
1115- lyTop = lyBottom = Lib . mean ( unifiedHoverData . map ( function ( c ) { return ( c . y0 + c . y1 ) / 2 ; } ) ) - tHeight / 2 ;
1109+ lyTop = lyBottom = Lib . mean ( hoverData . map ( function ( c ) { return ( c . y0 + c . y1 ) / 2 ; } ) ) - tHeight / 2 ;
11161110 }
11171111
11181112 var lxRight , lxLeft ;
@@ -1121,11 +1115,11 @@ function createHoverText(hoverData, opts, gd) {
11211115 lxRight = avgX + HOVERTEXTPAD ;
11221116 lxLeft = avgX - HOVERTEXTPAD ;
11231117 } else {
1124- lxRight = Math . max . apply ( null , unifiedHoverData . map ( function ( c ) { return Math . max ( c . x0 , c . x1 ) ; } ) ) ;
1125- lxLeft = Math . min . apply ( null , unifiedHoverData . map ( function ( c ) { return Math . min ( c . x0 , c . x1 ) ; } ) ) ;
1118+ lxRight = Math . max . apply ( null , hoverData . map ( function ( c ) { return Math . max ( c . x0 , c . x1 ) ; } ) ) ;
1119+ lxLeft = Math . min . apply ( null , hoverData . map ( function ( c ) { return Math . min ( c . x0 , c . x1 ) ; } ) ) ;
11261120 }
11271121 } else {
1128- lxRight = lxLeft = Lib . mean ( unifiedHoverData . map ( function ( c ) { return ( c . x0 + c . x1 ) / 2 ; } ) ) - tWidth / 2 ;
1122+ lxRight = lxLeft = Lib . mean ( hoverData . map ( function ( c ) { return ( c . x0 + c . x1 ) / 2 ; } ) ) - tWidth / 2 ;
11291123 }
11301124
11311125 var xOffset = xa . _offset ;
0 commit comments