MCPcopy Index your code
hub / github.com/plotly/plotly.js / getBoundingClientRect

Function getBoundingClientRect

src/components/fx/hover.js:2550–2578  ·  view source on GitHub ↗
(gd, node)

Source from the content-addressed store, hash-verified

2548const getLeftOffset = (gd) => gd.offsetLeft + gd.clientLeft;
2549
2550function getBoundingClientRect(gd, node) {
2551 var fullLayout = gd._fullLayout;
2552
2553 var rect = node.getBoundingClientRect();
2554
2555 var x0 = rect.left;
2556 var y0 = rect.top;
2557 var x1 = x0 + rect.width;
2558 var y1 = y0 + rect.height;
2559
2560 var A = Lib.apply3DTransform(fullLayout._invTransform)(x0, y0);
2561 var B = Lib.apply3DTransform(fullLayout._invTransform)(x1, y1);
2562
2563 var Ax = A[0];
2564 var Ay = A[1];
2565 var Bx = B[0];
2566 var By = B[1];
2567
2568 return {
2569 x: Ax,
2570 y: Ay,
2571 width: Bx - Ax,
2572 height: By - Ay,
2573 top: Math.min(Ay, By),
2574 left: Math.min(Ax, Bx),
2575 right: Math.max(Ax, Bx),
2576 bottom: Math.max(Ay, By)
2577 };
2578}

Callers 1

createHoverTextFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…