source: [view]
this.node = dojo.byId(node);
var pos = e.touches ? e.touches[0] : e;
this.marginBox = {l: pos.pageX, t: pos.pageY};
this.mouseButton = e.button;
var h = (this.host = host), d = node.ownerDocument;
this.events = [
// At the start of a drag, onFirstMove is called, and then the following two
// connects are disconnected
dojo.connect(d, "onmousemove", this, "onFirstMove"),
dojo.connect(d, "ontouchmove", this, "onFirstMove"),
// These are called continually during the drag
dojo.connect(d, "onmousemove", this, "onMouseMove"),
dojo.connect(d, "ontouchmove", this, "onMouseMove"),
// And these are called at the end of the drag
dojo.connect(d, "onmouseup", this, "onMouseUp"),
dojo.connect(d, "ontouchend", this, "onMouseUp"),
// cancel text selection and text dragging
dojo.connect(d, "ondragstart", dojo.stopEvent),
dojo.connect(d.body, "onselectstart", dojo.stopEvent)
];
// notify that the move has started
if(h && h.onMoveStart){
h.onMoveStart(this);
}