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

Function drag

test/jasmine/tests/draw_newshape_test.js:16–40  ·  view source on GitHub ↗
(path, options)

Source from the content-addressed store, hash-verified

14var click = require('../assets/click');
15
16function drag(path, options) {
17 var len = path.length;
18
19 if(!options) options = { type: 'mouse' };
20
21 if(options.type === 'touch') {
22 touchEvent('touchstart', path[0][0], path[0][1], options);
23
24 path.slice(1, len).forEach(function(pt) {
25 touchEvent('touchmove', pt[0], pt[1], options);
26 });
27
28 touchEvent('touchend', path[len - 1][0], path[len - 1][1], options);
29 return;
30 }
31
32 mouseEvent('mousemove', path[0][0], path[0][1], options);
33 mouseEvent('mousedown', path[0][0], path[0][1], options);
34
35 path.slice(1, len).forEach(function(pt) {
36 mouseEvent('mousemove', pt[0], pt[1], options);
37 });
38
39 mouseEvent('mouseup', path[len - 1][0], path[len - 1][1], options);
40}
41
42function print(obj) {
43 // 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…