equal
deleted
inserted
replaced
|
1 d3.svg.mouse = function(container) { |
|
2 return d3_svg_mousePoint(container, d3.event); |
|
3 }; |
|
4 |
|
5 // https://bugs.webkit.org/show_bug.cgi?id=44083 |
|
6 var d3_mouse_bug44083 = /WebKit/.test(navigator.userAgent) ? -1 : 0; |
|
7 |
|
8 function d3_svg_mousePoint(container, e) { |
|
9 var point = (container.ownerSVGElement || container).createSVGPoint(); |
|
10 if ((d3_mouse_bug44083 < 0) && (window.scrollX || window.scrollY)) { |
|
11 var svg = d3.select(document.body) |
|
12 .append("svg:svg") |
|
13 .style("position", "absolute") |
|
14 .style("top", 0) |
|
15 .style("left", 0); |
|
16 var ctm = svg[0][0].getScreenCTM(); |
|
17 d3_mouse_bug44083 = !(ctm.f || ctm.e); |
|
18 svg.remove(); |
|
19 } |
|
20 if (d3_mouse_bug44083) { |
|
21 point.x = e.pageX; |
|
22 point.y = e.pageY; |
|
23 } else { |
|
24 point.x = e.clientX; |
|
25 point.y = e.clientY; |
|
26 } |
|
27 point = point.matrixTransform(container.getScreenCTM().inverse()); |
|
28 return [point.x, point.y]; |
|
29 }; |