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

Function testAnnotationMoveLabel

test/jasmine/tests/domain_ref_interact_test.js:75–100  ·  view source on GitHub ↗
(objectColor, moveX, moveY)

Source from the content-addressed store, hash-verified

73
74// Tests moving the annotation label
75function testAnnotationMoveLabel(objectColor, moveX, moveY) {
76 var bboxAfter;
77 // Get where the text box (label) is before dragging it
78 var bboxBefore = getSVGElemScreenBBox(
79 domainRefComponents.findAROByColor(objectColor, undefined, 'rect')
80 );
81 // we have to use drag to move annotations for some reason
82 var optLabelDrag = {
83 pos0: dragPos0(bboxBefore)
84 };
85 optLabelDrag.dpos = [moveX, moveY];
86 // console.log('optLabelDrag', optLabelDrag);
87 // drag the label, this will make the arrow rotate around the arrowhead
88 return (new Promise(function(resolve) {
89 drag(optLabelDrag); resolve();
90 }))
91 .then(delay(DELAY_TIME))
92 .then(function() {
93 // then check it's position
94 bboxAfter = getSVGElemScreenBBox(
95 domainRefComponents.findAROByColor(objectColor, undefined, 'rect')
96 );
97 checkBBox(bboxBefore, bboxAfter, moveX, moveY);
98 })
99 .then(delay(DELAY_TIME));
100}
101
102// Tests moving the whole annotation
103function testAnnotationMoveWhole(objectColor, arrowColor, moveX, moveY, corner) {

Callers 1

Calls 4

getSVGElemScreenBBoxFunction · 0.85
dragPos0Function · 0.85
checkBBoxFunction · 0.85
dragFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…