d3.mouse performs a little strange in mouse events. When the svg did not on the left of screen, if I use the zoom tool of browser, it can’t recognize the location of mouse correctly. It happens in IE9, chrome, safari, opera, only in firefox it works well.
I made a simple demo of that: http://walkpie.cnodejs.net/
You can review the demo and download the code in the demo page.
The core part of the demo:
<td width="35%" style="background-color: steelblue;">This is Left.</td>
var vis = d3.select("#container")
var cl = vis.append("circle")
var cp = d3.mouse(this);
Btw, it works well in Firefox.
Is the issue supposed to be fixed in d3.v3 ? I am still experiencing the same problem under Chrome.
No, this is a browser bug, and there is no explicit workaround in D3.
As far as I can tell, this has been fixed in current browsers. However, it is related to d3/d3-selection#67.