@@ -913,7 +913,7 @@ function _hover(gd, evt, subplot, noHoverEvent, eventTarget) {
913
913
914
914
if ( ! helpers . isUnifiedHover ( hovermode ) ) {
915
915
hoverAvoidOverlaps ( hoverLabels , rotateLabels , fullLayout , hoverText . commonLabelBoundingBox ) ;
916
- alignHoverText ( hoverLabels , rotateLabels , fullLayout . _invScaleX , fullLayout . _invScaleY ) ;
916
+ alignHoverText ( hoverLabels , rotateLabels , fullLayout . _invScaleX , fullLayout . _invScaleY , fullLayout . hoverlabel . showarrow ) ;
917
917
} // TODO: tagName hack is needed to appease geo.js's hack of using eventTarget=true
918
918
// we should improve the "fx" API so other plots can use it without these hack.
919
919
if ( eventTarget && eventTarget . tagName ) {
@@ -1903,7 +1903,7 @@ function getTextShiftX(hoverLabel) {
1903
1903
} ;
1904
1904
}
1905
1905
1906
- function alignHoverText ( hoverLabels , rotateLabels , scaleX , scaleY ) {
1906
+ function alignHoverText ( hoverLabels , rotateLabels , scaleX , scaleY , showArrow ) {
1907
1907
var pX = function ( x ) { return x * scaleX ; } ;
1908
1908
var pY = function ( y ) { return y * scaleY ; } ;
1909
1909
@@ -1923,19 +1923,26 @@ function alignHoverText(hoverLabels, rotateLabels, scaleX, scaleY) {
1923
1923
1924
1924
var isMiddle = anchor === 'middle' ;
1925
1925
1926
- g . select ( 'path' )
1927
- . attr ( 'd' , isMiddle ?
1926
+ var pathStr ;
1927
+ if ( isMiddle ) {
1928
1928
// middle aligned: rect centered on data
1929
- ( 'M-' + pX ( d . bx / 2 + d . tx2width / 2 ) + ',' + pY ( offsetY - d . by / 2 ) +
1930
- 'h' + pX ( d . bx ) + 'v' + pY ( d . by ) + 'h-' + pX ( d . bx ) + 'Z' ) :
1929
+ pathStr = 'M-' + pX ( d . bx / 2 + d . tx2width / 2 ) + ',' + pY ( offsetY - d . by / 2 ) +
1930
+ 'h' + pX ( d . bx ) + 'v' + pY ( d . by ) + 'h-' + pX ( d . bx ) + 'Z' ;
1931
+ } else if ( showArrow !== false ) {
1931
1932
// left or right aligned: side rect with arrow to data
1932
- ( 'M0,0L' + pX ( horzSign * HOVERARROWSIZE + offsetX ) + ',' + pY ( HOVERARROWSIZE + offsetY ) +
1933
- 'v' + pY ( d . by / 2 - HOVERARROWSIZE ) +
1934
- 'h' + pX ( horzSign * d . bx ) +
1935
- 'v-' + pY ( d . by ) +
1936
- 'H' + pX ( horzSign * HOVERARROWSIZE + offsetX ) +
1937
- 'V' + pY ( offsetY - HOVERARROWSIZE ) +
1938
- 'Z' ) ) ;
1933
+ pathStr = 'M0,0L' + pX ( horzSign * HOVERARROWSIZE + offsetX ) + ',' + pY ( HOVERARROWSIZE + offsetY ) +
1934
+ 'v' + pY ( d . by / 2 - HOVERARROWSIZE ) +
1935
+ 'h' + pX ( horzSign * d . bx ) +
1936
+ 'v-' + pY ( d . by ) +
1937
+ 'H' + pX ( horzSign * HOVERARROWSIZE + offsetX ) +
1938
+ 'V' + pY ( offsetY - HOVERARROWSIZE ) +
1939
+ 'Z' ;
1940
+ } else {
1941
+ // left or right aligned: side rect without arrow
1942
+ pathStr = 'M' + pX ( horzSign * HOVERARROWSIZE + offsetX ) + ',' + pY ( offsetY - d . by / 2 ) +
1943
+ 'h' + pX ( horzSign * d . bx ) + 'v' + pY ( d . by ) + 'h' + pX ( - horzSign * d . bx ) + 'Z' ;
1944
+ }
1945
+ g . select ( 'path' ) . attr ( 'd' , pathStr ) ;
1939
1946
1940
1947
var posX = offsetX + shiftX . textShiftX ;
1941
1948
var posY = offsetY + d . ty0 - d . by / 2 + HOVERTEXTPAD ;
0 commit comments