Skip to content

Commit 2e7b3dd

Browse files
committed
use Axes.getPxPosition instead of ax._boundingBox
... to position cartesian spike edges. This allows us to not have to compute the axis bounding box to render the spikes.
1 parent 9781e8c commit 2e7b3dd

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/components/fx/hover.js

+6-7
Original file line numberDiff line numberDiff line change
@@ -605,15 +605,15 @@ function _hover(gd, evt, subplot, noHoverEvent) {
605605
var result = dragElement.unhoverRaw(gd, evt);
606606
if(hasCartesian && ((spikePoints.hLinePoint !== null) || (spikePoints.vLinePoint !== null))) {
607607
if(spikesChanged(oldspikepoints)) {
608-
createSpikelines(spikePoints, spikelineOpts);
608+
createSpikelines(gd, spikePoints, spikelineOpts);
609609
}
610610
}
611611
return result;
612612
}
613613

614614
if(hasCartesian) {
615615
if(spikesChanged(oldspikepoints)) {
616-
createSpikelines(spikePoints, spikelineOpts);
616+
createSpikelines(gd, spikePoints, spikelineOpts);
617617
}
618618
}
619619

@@ -1396,9 +1396,10 @@ function cleanPoint(d, hovermode) {
13961396
return d;
13971397
}
13981398

1399-
function createSpikelines(closestPoints, opts) {
1399+
function createSpikelines(gd, closestPoints, opts) {
14001400
var container = opts.container;
14011401
var fullLayout = opts.fullLayout;
1402+
var gs = fullLayout._size;
14021403
var evt = opts.event;
14031404
var showY = !!closestPoints.hLinePoint;
14041405
var showX = !!closestPoints.vLinePoint;
@@ -1433,8 +1434,7 @@ function createSpikelines(closestPoints, opts) {
14331434
var yMode = ya.spikemode;
14341435
var yThickness = ya.spikethickness;
14351436
var yColor = ya.spikecolor || dfltHLineColor;
1436-
var yBB = ya._boundingBox;
1437-
var xEdge = ((yBB.left + yBB.right) / 2) < hLinePointX ? yBB.right : yBB.left;
1437+
var xEdge = Axes.getPxPosition(gd, ya);
14381438
var xBase, xEndSpike;
14391439

14401440
if(yMode.indexOf('toaxis') !== -1 || yMode.indexOf('across') !== -1) {
@@ -1507,8 +1507,7 @@ function createSpikelines(closestPoints, opts) {
15071507
var xMode = xa.spikemode;
15081508
var xThickness = xa.spikethickness;
15091509
var xColor = xa.spikecolor || dfltVLineColor;
1510-
var xBB = xa._boundingBox;
1511-
var yEdge = ((xBB.top + xBB.bottom) / 2) < vLinePointY ? xBB.bottom : xBB.top;
1510+
var yEdge = Axes.getPxPosition(gd, xa);
15121511
var yBase, yEndSpike;
15131512

15141513
if(xMode.indexOf('toaxis') !== -1 || xMode.indexOf('across') !== -1) {

0 commit comments

Comments
 (0)