Skip to content

Commit

Permalink
use Axes.getPxPosition instead of ax._boundingBox
Browse files Browse the repository at this point in the history
... to position cartesian spike edges. This allows us to not
    have to compute the axis bounding box to render the spikes.
  • Loading branch information
etpinard committed Sep 4, 2019
1 parent 9781e8c commit 2e7b3dd
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/components/fx/hover.js
Original file line number Diff line number Diff line change
Expand Up @@ -605,15 +605,15 @@ function _hover(gd, evt, subplot, noHoverEvent) {
var result = dragElement.unhoverRaw(gd, evt);
if(hasCartesian && ((spikePoints.hLinePoint !== null) || (spikePoints.vLinePoint !== null))) {
if(spikesChanged(oldspikepoints)) {
createSpikelines(spikePoints, spikelineOpts);
createSpikelines(gd, spikePoints, spikelineOpts);
}
}
return result;
}

if(hasCartesian) {
if(spikesChanged(oldspikepoints)) {
createSpikelines(spikePoints, spikelineOpts);
createSpikelines(gd, spikePoints, spikelineOpts);
}
}

Expand Down Expand Up @@ -1396,9 +1396,10 @@ function cleanPoint(d, hovermode) {
return d;
}

function createSpikelines(closestPoints, opts) {
function createSpikelines(gd, closestPoints, opts) {
var container = opts.container;
var fullLayout = opts.fullLayout;
var gs = fullLayout._size;
var evt = opts.event;
var showY = !!closestPoints.hLinePoint;
var showX = !!closestPoints.vLinePoint;
Expand Down Expand Up @@ -1433,8 +1434,7 @@ function createSpikelines(closestPoints, opts) {
var yMode = ya.spikemode;
var yThickness = ya.spikethickness;
var yColor = ya.spikecolor || dfltHLineColor;
var yBB = ya._boundingBox;
var xEdge = ((yBB.left + yBB.right) / 2) < hLinePointX ? yBB.right : yBB.left;
var xEdge = Axes.getPxPosition(gd, ya);
var xBase, xEndSpike;

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

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

0 comments on commit 2e7b3dd

Please sign in to comment.