Skip to content

Commit 5a80515

Browse files
committed
refactor
1 parent b26fcbb commit 5a80515

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/components/fx/hover.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -1089,6 +1089,9 @@ function createHoverText(hoverData, opts, gd) {
10891089

10901090
var legendContainer = container.select('g.legend');
10911091
var tbb = legendContainer.node().getBoundingClientRect();
1092+
var txWidth = tbb.width + 2 * HOVERTEXTPAD;
1093+
var txHeight = tbb.height + 2 * HOVERTEXTPAD;
1094+
10921095
var xOffset = xa._offset;
10931096
var yOffset = ya._offset;
10941097
lxRight += xOffset;
@@ -1100,7 +1103,6 @@ function createHoverText(hoverData, opts, gd) {
11001103
var ly = lyTop;
11011104

11021105
// Change horizontal alignment to end up on screen
1103-
var txWidth = tbb.width + 2 * HOVERTEXTPAD;
11041106
var anchorRightOK = lxRight + txWidth <= outerWidth;
11051107
var anchorLeftOK = lxLeft - txWidth >= 0;
11061108
if(!anchorRightOK && anchorLeftOK) {
@@ -1112,7 +1114,6 @@ function createHoverText(hoverData, opts, gd) {
11121114
}
11131115

11141116
// Change vertical alignement to end up on screen
1115-
var txHeight = tbb.height + 2 * HOVERTEXTPAD;
11161117
var anchorBottomOK = lyBottom + txHeight <= outerHeight;
11171118
var anchorTopOK = lyTop - txHeight >= 0;
11181119
if(!anchorTopOK && anchorBottomOK) {

0 commit comments

Comments
 (0)