MCPcopy Index your code
hub / github.com/plotly/plotly.js / drag

Function drag

test/jasmine/tests/draw_newselection_test.js:14–38  ·  view source on GitHub ↗
(path, options)

Source from the content-addressed store, hash-verified

12var click = require('../assets/click');
13
14function drag(path, options) {
15 var len = path.length;
16
17 if(!options) options = { type: 'mouse' };
18
19 if(options.type === 'touch') {
20 touchEvent('touchstart', path[0][0], path[0][1], options);
21
22 path.slice(1, len).forEach(function(pt) {
23 touchEvent('touchmove', pt[0], pt[1], options);
24 });
25
26 touchEvent('touchend', path[len - 1][0], path[len - 1][1], options);
27 return;
28 }
29
30 mouseEvent('mousemove', path[0][0], path[0][1], options);
31 mouseEvent('mousedown', path[0][0], path[0][1], options);
32
33 path.slice(1, len).forEach(function(pt) {
34 mouseEvent('mousemove', pt[0], pt[1], options);
35 });
36
37 mouseEvent('mouseup', path[len - 1][0], path[len - 1][1], options);
38}
39
40function print(obj) {
41 // console.log(JSON.stringify(obj, null, 4).replace(/"/g, '\''));

Callers 2

_dragFunction · 0.70

Calls 1

mouseEventFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…