Skip to content

Commit bab2a5b

Browse files
authored
Merge pull request #2590 from plotly/spikesnap-cursor-fix
fix spikesnap: cursor in FF
2 parents de22310 + b48920a commit bab2a5b

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

src/components/fx/hover.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -279,11 +279,9 @@ function _hover(gd, evt, subplot, noHoverEvent) {
279279
if(hasUserCalledHover) {
280280
if('xpx' in evt) xpx = evt.xpx;
281281
else xpx = xaArray[0]._length / 2;
282-
evt.pointerX = xpx + xaArray[0]._offset;
283282

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

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

306+
evt.pointerX = xpx + xaArray[0]._offset;
307+
evt.pointerY = ypx + yaArray[0]._offset;
308+
310309
if('xval' in evt) xvalArray = helpers.flat(subplots, evt.xval);
311310
else xvalArray = helpers.p2c(xaArray, xpx);
312311

tasks/test_syntax.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ function assertSrcContents() {
7373
// Forbidden in IE in any context
7474
var IE_BLACK_LIST = ['classList'];
7575

76+
// not implemented in FF, or inconsistent with others
77+
var FF_BLACK_LIST = ['offsetX', 'offsetY'];
78+
7679
// require'd built-in modules
7780
var BUILTINS = ['events'];
7881

@@ -103,6 +106,9 @@ function assertSrcContents() {
103106
else if(IE_SVG_BLACK_LIST.indexOf(lastPart) !== -1) {
104107
logs.push(file + ' : contains .' + lastPart + ' (IE failure in SVG)');
105108
}
109+
else if(FF_BLACK_LIST.indexOf(lastPart) !== -1) {
110+
logs.push(file + ' : contains .' + lastPart + ' (FF failure)');
111+
}
106112
}
107113
else if(node.type === 'Identifier' && node.source() === 'getComputedStyle') {
108114
if(node.parent.source() !== 'window.getComputedStyle') {

0 commit comments

Comments
 (0)