Skip to content

Commit d1f2800

Browse files
committed
adjust size and position of hover box in respect to css transform
1 parent 388986b commit d1f2800

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

src/components/fx/hover.js

+11-7
Original file line numberDiff line numberDiff line change
@@ -1326,22 +1326,26 @@ function createHoverText(hoverData, opts) {
13261326
stroke: contrastColor
13271327
});
13281328

1329-
var tbb = getBoundingClientRect(gd, tx.node());
13301329
var htx = d.xa._offset + (d.x0 + d.x1) / 2;
13311330
var hty = d.ya._offset + (d.y0 + d.y1) / 2;
13321331
var dx = Math.abs(d.x1 - d.x0);
13331332
var dy = Math.abs(d.y1 - d.y0);
1334-
var txTotalWidth = tbb.width + HOVERARROWSIZE + HOVERTEXTPAD + tx2width;
1335-
var anchorStartOK, anchorEndOK;
13361333

1337-
d.ty0 = outerTop - tbb.top;
1338-
d.bx = tbb.width + 2 * HOVERTEXTPAD;
1339-
d.by = Math.max(tbb.height + 2 * HOVERTEXTPAD, tx2height);
1334+
var tbb = getBoundingClientRect(gd, tx.node());
1335+
var tbbWidth = tbb.width / fullLayout._invScaleX;
1336+
var tbbHeight = tbb.height / fullLayout._invScaleY;
1337+
1338+
d.ty0 = (outerTop - tbb.top) / fullLayout._invScaleY;
1339+
d.bx = tbbWidth + 2 * HOVERTEXTPAD;
1340+
d.by = Math.max(tbbHeight + 2 * HOVERTEXTPAD, tx2height);
13401341
d.anchor = 'start';
1341-
d.txwidth = tbb.width;
1342+
d.txwidth = tbbWidth;
13421343
d.tx2width = tx2width;
13431344
d.offset = 0;
13441345

1346+
var txTotalWidth = (tbbWidth + HOVERARROWSIZE + HOVERTEXTPAD + tx2width) * fullLayout._invScaleX;
1347+
var anchorStartOK, anchorEndOK;
1348+
13451349
if(rotateLabels) {
13461350
d.pos = htx;
13471351
anchorStartOK = hty + dy / 2 + txTotalWidth <= outerHeight;

0 commit comments

Comments
 (0)