Sha256: c99a720a080ea253c6b7243cea936d60d3e73da93b4f3365a78a8d0ba90b0821

Contents?: true

Size: 895 Bytes

Versions: 6

Compression:

Stored size: 895 Bytes

Contents

d3.svg.mouse = function(container) {
  return d3_svg_mousePoint(container, d3.event);
};

// https://bugs.webkit.org/show_bug.cgi?id=44083
var d3_mouse_bug44083 = /WebKit/.test(navigator.userAgent) ? -1 : 0;

function d3_svg_mousePoint(container, e) {
  var point = (container.ownerSVGElement || container).createSVGPoint();
  if ((d3_mouse_bug44083 < 0) && (window.scrollX || window.scrollY)) {
    var svg = d3.select(document.body)
      .append("svg:svg")
        .style("position", "absolute")
        .style("top", 0)
        .style("left", 0);
    var ctm = svg[0][0].getScreenCTM();
    d3_mouse_bug44083 = !(ctm.f || ctm.e);
    svg.remove();
  }
  if (d3_mouse_bug44083) {
    point.x = e.pageX;
    point.y = e.pageY;
  } else {
    point.x = e.clientX;
    point.y = e.clientY;
  }
  point = point.matrixTransform(container.getScreenCTM().inverse());
  return [point.x, point.y];
};

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
bum-0.0.17 public/d3/src/svg/mouse.js
bum-0.0.16 public/d3/src/svg/mouse.js
bum-0.0.15 public/d3/src/svg/mouse.js
bum-0.0.14 public/d3/src/svg/mouse.js
bum-0.0.13 public/d3/src/svg/mouse.js
bum-0.0.12 public/d3/src/svg/mouse.js