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

Function testAnnotationMoveWhole

test/jasmine/tests/domain_ref_interact_test.js:103–135  ·  view source on GitHub ↗
(objectColor, arrowColor, moveX, moveY, corner)

Source from the content-addressed store, hash-verified

101
102// Tests moving the whole annotation
103function testAnnotationMoveWhole(objectColor, arrowColor, moveX, moveY, corner) {
104 var bboxAfter;
105 var arrowBBoxAfter;
106 // Get where the text box (label) is before dragging it
107 var bboxBefore = getSVGElemScreenBBox(
108 domainRefComponents.findAROByColor(objectColor, undefined, 'rect')
109 );
110 var arrowBBoxBefore = getSVGElemScreenBBox(
111 domainRefComponents.findAROByColor(arrowColor, undefined, 'path', 'fill')
112 );
113 var optArrowDrag = {
114 pos0: dragPos0(arrowBBoxBefore, corner)
115 };
116 optArrowDrag.dpos = [moveX, moveY];
117 // console.log('optArrowDrag', optArrowDrag);
118 // drag the whole annotation
119 (new Promise(function(resolve) {
120 drag(optArrowDrag); resolve();
121 }))
122 .then(delay(DELAY_TIME))
123 .then(function() {
124 // check the new position of the arrow and label
125 arrowBBoxAfter = getSVGElemScreenBBox(
126 domainRefComponents.findAROByColor(arrowColor, undefined, 'path', 'fill')
127 );
128 bboxAfter = getSVGElemScreenBBox(
129 domainRefComponents.findAROByColor(objectColor, undefined, 'rect')
130 );
131 checkBBox(arrowBBoxBefore, arrowBBoxAfter, moveX, moveY);
132 checkBBox(bboxBefore, bboxAfter, moveX, moveY);
133 })
134 .then(delay(DELAY_TIME));
135}
136
137describe('Shapes referencing domain', function() {
138 var gd;

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…