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

Function shapeToBBox

test/jasmine/assets/domain_ref_components.js:379–394  ·  view source on GitHub ↗
(layout, aro)

Source from the content-addressed store, hash-verified

377// compute the bounding box of the shape so that it can be compared with the SVG
378// bounding box
379function shapeToBBox(layout, aro) {
380 var bbox = {};
381 var x1;
382 var y1;
383 // map x coordinates
384 bbox.x = mapAROCoordToPixel(layout, 'xref', aro, 'x0');
385 x1 = mapAROCoordToPixel(layout, 'xref', aro, 'x1');
386 // SVG bounding boxes have x,y referring to top left corner, but here we are
387 // specifying aros where y0 refers to the bottom left corner like
388 // Plotly.js, so we swap y0 and y1
389 bbox.y = mapAROCoordToPixel(layout, 'yref', aro, 'y1');
390 y1 = mapAROCoordToPixel(layout, 'yref', aro, 'y0');
391 bbox.width = x1 - bbox.x;
392 bbox.height = y1 - bbox.y;
393 return bbox;
394}
395
396function imageToBBox(layout, img) {
397 var bbox = {};

Callers 1

checkAROPositionFunction · 0.85

Calls 1

mapAROCoordToPixelFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…