Closed sungwoncho closed 8 years ago
Are you sure your width and height are correct? width + margin.left + margin.right
evaluates to a number and not NaN
?
Also, I'd try setting a breakpoint, maybe around here, and looking for anything suspicious. d3.mouse
uses a function called point
which accesses getBoundingClientRect
, something that was added pretty recently.
@sungwoncho I am using the d3 event for now:
...
.on('mousemove', function() {
console.log(d3.event.layerX, d3.event.layerY;);
});
...
I will try again soon and close if not a bug.
Any thoughts on this? Reproducible as a test?
@Olical I am currently not working on a feature involving this bug and have some other priorities. But I will get back to this one.
Since it doesn't seem to be a widespread issue (maybe a rare edge case?) I'll close this for now. Feel free to open it again if you hit it. A test that reproduces it would be brilliant, but no pressure.
Thanks for the initial report anyway! I'll keep this in mind.
I have a similar problem. It might be related to the fact that this
is not a real d3 node.
d3.mouse(this)
returns [NaN,NaN]
, whereas d3.mouse(d3.select('svg').select('g').node())
returns the correct value.
@BeshoyLouka workaround is good though.
This also breaks zoom support because x and y in the transform object in d3 zoom event are also NaN
.
Version: latest react-faux-dom (2.7.1) and React 15.1.0.
When I do:
pos
is always[NaN, NaN]
.I can confirm that
this
inside themousemove
callback is a DOM element (e.g.Element {nodeName: "rect", parentNode: Element, childNodes: Array[0], eventListeners: Object, text: ""…}
).Any ideas why?