MCPcopy Create free account
hub / github.com/idank/explainshell / d3_mousePoint

Function d3_mousePoint

explainshell/web/static/js/d3.v3.js:433–455  ·  view source on GitHub ↗
(container, e)

Source from the content-addressed store, hash-verified

431 };
432 var d3_mouse_bug44083 = /WebKit/.test(d3_window.navigator.userAgent) ? -1 : 0;
433 function d3_mousePoint(container, e) {
434 var svg = container.ownerSVGElement || container;
435 if (svg.createSVGPoint) {
436 var point = svg.createSVGPoint();
437 if (d3_mouse_bug44083 < 0 && (d3_window.scrollX || d3_window.scrollY)) {
438 svg = d3.select(d3_document.body).append("svg").style("position", "absolute").style("top", 0).style("left", 0);
439 var ctm = svg[0][0].getScreenCTM();
440 d3_mouse_bug44083 = !(ctm.f || ctm.e);
441 svg.remove();
442 }
443 if (d3_mouse_bug44083) {
444 point.x = e.pageX;
445 point.y = e.pageY;
446 } else {
447 point.x = e.clientX;
448 point.y = e.clientY;
449 }
450 point = point.matrixTransform(container.getScreenCTM().inverse());
451 return [ point.x, point.y ];
452 }
453 var rect = container.getBoundingClientRect();
454 return [ e.clientX - rect.left - container.clientLeft, e.clientY - rect.top - container.clientTop ];
455 }
456 var d3_array = d3_arraySlice;
457 function d3_arrayCopy(pseudoarray) {
458 var i = -1, n = pseudoarray.length, array = [];

Callers 1

d3.v3.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected