Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a9c899b

Browse files
committed
unified hoverlabel: return early if nothing is hovered on
1 parent 33a037b commit a9c899b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/components/fx/hover.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -931,6 +931,9 @@ function createHoverText(hoverData, opts, gd) {
931931
// similarly to compare mode, we remove the "close but not quite together" points
932932
if((t0 !== undefined) && (c0.distance <= opts.hoverdistance)) hoverData = filterClosePoints(hoverData);
933933

934+
// Return early if nothing is hovered on
935+
if(hoverData.length === 0) return;
936+
934937
// mock legend
935938
var mockLayoutIn = {
936939
showlegend: true,
@@ -979,9 +982,6 @@ function createHoverText(hoverData, opts, gd) {
979982
}
980983
legendOpts.layer = container;
981984

982-
// Return early if nothing is hovered on
983-
if(legendOpts.entries.length === 0) return;
984-
985985
// Draw unified hover label
986986
legendDraw(gd, legendOpts);
987987

0 commit comments

Comments
 (0)