MCPcopy
hub / github.com/bevacqua/dragula / dragula

Function dragula

dragula.js:9–496  ·  view source on GitHub ↗
(initialContainers, options)

Source from the content-addressed store, hash-verified

7var documentElement = doc.documentElement;
8
9function dragula (initialContainers, options) {
10 var len = arguments.length;
11 if (len === 1 && Array.isArray(initialContainers) === false) {
12 options = initialContainers;
13 initialContainers = [];
14 }
15 var _mirror; // mirror image
16 var _source; // source container
17 var _item; // item being dragged
18 var _offsetX; // reference x
19 var _offsetY; // reference y
20 var _moveX; // reference move x
21 var _moveY; // reference move y
22 var _initialSibling; // reference sibling when grabbed
23 var _currentSibling; // reference sibling now
24 var _copy; // item used for copying
25 var _renderTimer; // timer for setTimeout renderMirrorImage
26 var _lastDropTarget = null; // last container item was over
27 var _grabbed; // holds mousedown context until first mousemove
28
29 var o = options || {};
30 if (o.moves === void 0) { o.moves = always; }
31 if (o.accepts === void 0) { o.accepts = always; }
32 if (o.invalid === void 0) { o.invalid = invalidTarget; }
33 if (o.containers === void 0) { o.containers = initialContainers || []; }
34 if (o.isContainer === void 0) { o.isContainer = never; }
35 if (o.copy === void 0) { o.copy = false; }
36 if (o.copySortSource === void 0) { o.copySortSource = false; }
37 if (o.revertOnSpill === void 0) { o.revertOnSpill = false; }
38 if (o.removeOnSpill === void 0) { o.removeOnSpill = false; }
39 if (o.direction === void 0) { o.direction = 'vertical'; }
40 if (o.ignoreInputTextSelection === void 0) { o.ignoreInputTextSelection = true; }
41 if (o.mirrorContainer === void 0) { o.mirrorContainer = doc.body; }
42
43 var drake = emitter({
44 containers: o.containers,
45 start: manualStart,
46 end: end,
47 cancel: cancel,
48 remove: remove,
49 destroy: destroy,
50 canMove: canMove,
51 dragging: false
52 });
53
54 if (o.removeOnSpill === true) {
55 drake.on('over', spillOver).on('out', spillOut);
56 }
57
58 events();
59
60 return drake;
61
62 function isContainer (el) {
63 return drake.containers.indexOf(el) !== -1 || o.isContainer(el);
64 }
65
66 function events (remove) {

Callers 13

example.min.jsFile · 0.85
example.jsFile · 0.85
drakeFactoryFunction · 0.85
drake-api.jsFile · 0.85
defaults.jsFile · 0.85
end.jsFile · 0.85
remove.jsFile · 0.85
destroy.jsFile · 0.85
containers.jsFile · 0.85
cancel.jsFile · 0.85
events.jsFile · 0.85
testCaseFunction · 0.85

Calls 1

eventsFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…