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

Function checkTextDrag

test/jasmine/tests/annotations_test.js:1124–1146  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1122 // for annotations with arrows: check that dragging the text moves only
1123 // ax and ay (and the textbox itself)
1124 function checkTextDrag() {
1125 var ann = gd.layout.annotations[0];
1126 var x0 = ann.x;
1127 var y0 = ann.y;
1128 var ax0 = ann.ax;
1129 var ay0 = ann.ay;
1130
1131 var bboxInitial = textBox().getBoundingClientRect();
1132
1133 return dragAndReplot(textDrag(), 50, -50)
1134 .then(function() {
1135 var bbox = textBox().getBoundingClientRect();
1136 expect(bbox.left).toBeWithin(bboxInitial.left + 50, 1);
1137 expect(bbox.top).toBeWithin(bboxInitial.top - 50, 1);
1138
1139 ann = gd.layout.annotations[0];
1140
1141 expect(ann.x).toBe(x0);
1142 expect(ann.y).toBe(y0);
1143 expect(ann.ax).toBeWithin(ax0 + 50, 1);
1144 expect(ann.ay).toBeWithin(ay0 - 50, 1);
1145 });
1146 }
1147
1148 it('respects anchor: auto when paper-referenced without arrow', function(done) {
1149 makePlot([{

Callers

nothing calls this directly

Calls 3

textBoxFunction · 0.85
dragAndReplotFunction · 0.85
textDragFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…