Skip to content

Commit 17dbadd

Browse files
committed
ensure x0 <= x1 and y0 <= y1
1 parent 03b22ec commit 17dbadd

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

src/components/fx/hover.js

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -753,11 +753,21 @@ function _hover(gd, evt, subplot, noHoverEvent) {
753753
}
754754

755755
if(pt.xa && pt.ya) {
756+
var _x0 = pt.x0 + pt.xa._offset;
757+
var _x1 = pt.x1 + pt.xa._offset;
758+
var _y0 = pt.y0 + pt.ya._offset;
759+
var _y1 = pt.y1 + pt.ya._offset;
760+
761+
var x0 = Math.min(_x0, _x1);
762+
var x1 = Math.max(_x0, _x1);
763+
var y0 = Math.min(_y0, _y1);
764+
var y1 = Math.max(_y0, _y1);
765+
756766
eventData.bbox = {
757-
x0: pt.x0 + pt.xa._offset + gLeft,
758-
x1: pt.x1 + pt.xa._offset + gLeft,
759-
y0: pt.y0 + pt.ya._offset + gTop,
760-
y1: pt.y1 + pt.ya._offset + gTop
767+
x0: x0 + gLeft,
768+
x1: x1 + gLeft,
769+
y0: y0 + gTop,
770+
y1: y1 + gTop
761771
};
762772
}
763773

0 commit comments

Comments
 (0)