Skip to content

Commit b8b9395

Browse files
committed
hover: 🔪 TODO, improve how we check for compare mode
1 parent 23e1c20 commit b8b9395

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
@@ -45,6 +45,8 @@ var YSHIFTY = Math.sin(YA_RADIANS);
4545
var HOVERARROWSIZE = constants.HOVERARROWSIZE;
4646
var HOVERTEXTPAD = constants.HOVERTEXTPAD;
4747

48+
var XY = {x: 1, y: 1};
49+
4850
// fx.hover: highlight data on hover
4951
// evt can be a mousemove event, or an object with data about what points
5052
// to hover on
@@ -630,7 +632,7 @@ function _hover(gd, evt, subplot, noHoverEvent) {
630632

631633
// If in compare mode, select every point at position
632634
if(hoverData[0].length !== 0 &&
633-
['x', 'y'].indexOf(mode) !== -1 &&
635+
XY[mode] &&
634636
hoverData[0].trace.type !== 'splom' // TODO: add support for splom
635637
) {
636638
var hd = hoverData[0];
@@ -657,7 +659,6 @@ function _hover(gd, evt, subplot, noHoverEvent) {
657659

658660
// Remove duplicated hoverData points
659661
// note that d3 also filters identical points in the rendering steps
660-
// TODO: use ES6 map
661662
var repeated = {};
662663
hoverData = hoverData.filter(function(hd) {
663664
var key = hoverDataKey(hd);

0 commit comments

Comments
 (0)