MCPcopy
hub / github.com/plotly/plotly.js / getSVGElemScreenBBox

Function getSVGElemScreenBBox

test/jasmine/assets/get_svg_elem_screen_bbox.js:15–29  ·  view source on GitHub ↗
(elem)

Source from the content-addressed store, hash-verified

13// Based off of this:
14// https://stackoverflow.com/questions/26049488/how-to-get-absolute-coordinates-of-object-inside-a-g-group
15function getSVGElemScreenBBox(elem) {
16 var svg = SVGTools.findParentSVG(elem);
17 var rect = svg.createSVGRect();
18 var pt = svg.createSVGPoint();
19 var ctm = elem.getScreenCTM();
20 var bbox = elem.getBBox();
21 pt.x = bbox.x;
22 pt.y = bbox.y;
23 rect.width = bbox.width;
24 rect.height = bbox.height;
25 pt = pt.matrixTransform(ctm);
26 rect.x = pt.x;
27 rect.y = pt.y;
28 return rect;
29}

Callers 6

annotationTestFunction · 0.85
imageTestFunction · 0.85
checkAROPositionFunction · 0.85
testObjectMoveFunction · 0.85
testAnnotationMoveLabelFunction · 0.85
testAnnotationMoveWholeFunction · 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…