react-image-magnifier
react-image-magnifier copied to clipboard
e.x is undefined in Firefox
Went to use this in a project today, and did not test well in firefox. The issue ended up being that the mouseevent used to set state isn't available in Firefox. So I used clientX
& clientY
instead. I'll make a PR if I have time.
this.setState({
x : e.x + window.scrollX,
y : e.y + window.scrollY,
offsetX : e.x - offset.x,
offsetY : e.y - offset.y
});
Should be
this.setState({
x : e.clientX + window.scrollX,
y : e.clientY + window.scrollY,
offsetX : e.clientX - offset.x,
offsetY : e.clientY - offset.y
});