source: Dev/branches/jQueryUI/client/d3/src/svg/mouse.js @ 249

Last change on this file since 249 was 249, checked in by hendrikvanantwerpen, 13 years ago

This one's for Subversion, because it's so close...

First widget (stripped down sequencer).
Seperated client and server code in two direcotry trees.

File size: 895 bytes
Line 
1d3.svg.mouse = function(container) {
2  return d3_svg_mousePoint(container, d3.event);
3};
4
5// https://bugs.webkit.org/show_bug.cgi?id=44083
6var d3_mouse_bug44083 = /WebKit/.test(navigator.userAgent) ? -1 : 0;
7
8function 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};
Note: See TracBrowser for help on using the repository browser.