react-image-magnifier icon indicating copy to clipboard operation
react-image-magnifier copied to clipboard

e.x is undefined in Firefox

Open kylecesmat opened this issue 9 years ago • 0 comments

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
        });

kylecesmat avatar Aug 19 '15 19:08 kylecesmat