Skip to content

Commit

Permalink
Merge pull request #2590 from plotly/spikesnap-cursor-fix
Browse files Browse the repository at this point in the history
fix spikesnap: cursor in FF
  • Loading branch information
alexcjohnson authored Apr 27, 2018
2 parents de22310 + b48920a commit bab2a5b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/components/fx/hover.js
Original file line number Diff line number Diff line change
Expand Up @@ -279,11 +279,9 @@ function _hover(gd, evt, subplot, noHoverEvent) {
if(hasUserCalledHover) {
if('xpx' in evt) xpx = evt.xpx;
else xpx = xaArray[0]._length / 2;
evt.pointerX = xpx + xaArray[0]._offset;

if('ypx' in evt) ypx = evt.ypx;
else ypx = yaArray[0]._length / 2;
evt.pointerY = ypx + yaArray[0]._offset;
}
else {
// fire the beforehover event and quit if it returns false
Expand All @@ -300,13 +298,14 @@ function _hover(gd, evt, subplot, noHoverEvent) {

// in case hover was called from mouseout into hovertext,
// it's possible you're not actually over the plot anymore
if(xpx < 0 || xpx > dbb.width || ypx < 0 || ypx > dbb.height) {
if(xpx < 0 || xpx > xaArray[0]._length || ypx < 0 || ypx > yaArray[0]._length) {
return dragElement.unhoverRaw(gd, evt);
}
evt.pointerX = evt.offsetX;
evt.pointerY = evt.offsetY;
}

evt.pointerX = xpx + xaArray[0]._offset;
evt.pointerY = ypx + yaArray[0]._offset;

if('xval' in evt) xvalArray = helpers.flat(subplots, evt.xval);
else xvalArray = helpers.p2c(xaArray, xpx);

Expand Down
6 changes: 6 additions & 0 deletions tasks/test_syntax.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ function assertSrcContents() {
// Forbidden in IE in any context
var IE_BLACK_LIST = ['classList'];

// not implemented in FF, or inconsistent with others
var FF_BLACK_LIST = ['offsetX', 'offsetY'];

// require'd built-in modules
var BUILTINS = ['events'];

Expand Down Expand Up @@ -103,6 +106,9 @@ function assertSrcContents() {
else if(IE_SVG_BLACK_LIST.indexOf(lastPart) !== -1) {
logs.push(file + ' : contains .' + lastPart + ' (IE failure in SVG)');
}
else if(FF_BLACK_LIST.indexOf(lastPart) !== -1) {
logs.push(file + ' : contains .' + lastPart + ' (FF failure)');
}
}
else if(node.type === 'Identifier' && node.source() === 'getComputedStyle') {
if(node.parent.source() !== 'window.getComputedStyle') {
Expand Down

0 comments on commit bab2a5b

Please sign in to comment.