Sha256: 4275fd1b108e4b324c2e7ee78b9d62a0e2cec84580af13581826406819a52c26
Contents?: true
Size: 1.18 KB
Versions: 4
Compression:
Stored size: 1.18 KB
Contents
import "../core/document"; d3.mouse = function(container) { return d3_mousePoint(container, d3_eventSource()); }; // https://bugs.webkit.org/show_bug.cgi?id=44083 var d3_mouse_bug44083 = /WebKit/.test(d3_window.navigator.userAgent) ? -1 : 0; function d3_mousePoint(container, e) { var svg = container.ownerSVGElement || container; if (svg.createSVGPoint) { var point = svg.createSVGPoint(); if (d3_mouse_bug44083 < 0 && (d3_window.scrollX || d3_window.scrollY)) { svg = d3.select("body").append("svg").style({ position: "absolute", top: 0, left: 0, margin: 0, padding: 0, border: "none" }, "important"); 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]; } var rect = container.getBoundingClientRect(); return [e.clientX - rect.left - container.clientLeft, e.clientY - rect.top - container.clientTop]; };
Version data entries
4 entries across 4 versions & 2 rubygems