Skip to content

Commit b240a70

Browse files
committed
refactor and add comments
1 parent 71a14e9 commit b240a70

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/components/fx/hover.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -651,19 +651,21 @@ function _hover(gd, evt, subplot, noHoverEvent) {
651651
};
652652
sortHoverData();
653653

654-
// If in compare mode, select every point at position
655654
if(
656655
helpers.isXYhover(_mode) &&
657656
hoverData[0].length !== 0 &&
658657
hoverData[0].trace.type !== 'splom' // TODO: add support for splom
659658
) {
659+
// pick winning point
660660
var winningPoint = hoverData[0];
661+
// discard other points
661662
hoverData = [winningPoint];
662663

663-
var customXVal = customVal('x', winningPoint, fullLayout);
664-
var customYVal = customVal('y', winningPoint, fullLayout);
664+
var winX = getCoord('x', winningPoint, fullLayout);
665+
var winY = getCoord('y', winningPoint, fullLayout);
665666

666-
findHoverPoints(customXVal, customYVal);
667+
// in compare mode, select every point at position
668+
findHoverPoints(winX, winY);
667669

668670
var finalPoints = [];
669671
var seen = {};
@@ -1908,7 +1910,7 @@ function orderRangePoints(hoverData, hovermode) {
19081910
return first.concat(second).concat(last);
19091911
}
19101912

1911-
function customVal(axLetter, winningPoint, fullLayout) {
1913+
function getCoord(axLetter, winningPoint, fullLayout) {
19121914
var ax = winningPoint[axLetter + 'a'];
19131915
var val = winningPoint[axLetter + 'Val'];
19141916

0 commit comments

Comments
 (0)