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

Function imageTest

test/jasmine/assets/domain_ref_components.js:478–518  ·  view source on GitHub ↗
(gd, layout, opt)

Source from the content-addressed store, hash-verified

476}
477
478function imageTest(gd, layout, opt) {
479 var xaxtype = opt.xaxtype;
480 var yaxtype = opt.yaxtype;
481 var x = opt.x;
482 var y = opt.y;
483 var sizex = opt.sizex;
484 var sizey = opt.sizey;
485 var xanchor = opt.xanchor;
486 var yanchor = opt.yanchor;
487 var xref = opt.xref;
488 var yref = opt.yref;
489 var xid = opt.xid;
490 var yid = opt.yid;
491
492 var image = {
493 x: x,
494 y: y,
495 sizex: sizex,
496 sizey: sizey,
497 source: testImage,
498 xanchor: xanchor,
499 yanchor: yanchor,
500 xref: xref,
501 yref: yref,
502 sizing: 'stretch'
503 };
504 var ret;
505 // we pass xid, yid because we possibly want to change some axes to log,
506 // even if we refer to paper in the end
507 logAxisIfAxType(gd.layout, layout, xid, xaxtype, true);
508 logAxisIfAxType(gd.layout, layout, yid, yaxtype, true);
509 layout.images = [image];
510 return Plotly.relayout(gd, layout)
511 .then(function(gd) {
512 var imageElem = findImage('#' + gd.id);
513 var svgImageBBox = getSVGElemScreenBBox(imageElem);
514 var imageBBox = imageToBBox(gd.layout, image);
515 ret = compareBBoxes(svgImageBBox, imageBBox);
516 return ret;
517 });
518}
519
520// gets the SVG bounding box of the aro and checks it against what mapToPixel
521// gives

Callers 1

testImageComboFunction · 0.85

Calls 5

logAxisIfAxTypeFunction · 0.85
findImageFunction · 0.85
getSVGElemScreenBBoxFunction · 0.85
imageToBBoxFunction · 0.85
compareBBoxesFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…