MCPcopy
hub / github.com/witheve/Eve / leftButtonStartDrag

Function leftButtonStartDrag

src/codemirror.js:3655–3681  ·  view source on GitHub ↗
(cm, e, start, modifier)

Source from the content-addressed store, hash-verified

3653 // Start a text drag. When it ends, see if any dragging actually
3654 // happen, and treat as a click if it didn't.
3655 function leftButtonStartDrag(cm, e, start, modifier) {
3656 var display = cm.display, startTime = +new Date;
3657 var dragEnd = operation(cm, function(e2) {
3658 if (webkit) display.scroller.draggable = false;
3659 cm.state.draggingText = false;
3660 off(document, "mouseup", dragEnd);
3661 off(display.scroller, "drop", dragEnd);
3662 if (Math.abs(e.clientX - e2.clientX) + Math.abs(e.clientY - e2.clientY) < 10) {
3663 e_preventDefault(e2);
3664 if (!modifier && +new Date - 200 < startTime)
3665 extendSelection(cm.doc, start);
3666 // Work around unexplainable focus problem in IE9 (#2127) and Chrome (#3081)
3667 if (webkit || ie && ie_version == 9)
3668 setTimeout(function() {document.body.focus(); display.input.focus();}, 20);
3669 else
3670 display.input.focus();
3671 }
3672 });
3673 // Let the drag handler handle this.
3674 if (webkit) display.scroller.draggable = true;
3675 cm.state.draggingText = dragEnd;
3676 dragEnd.copy = mac ? e.altKey : e.ctrlKey
3677 // IE's approach to draggable
3678 if (display.scroller.dragDrop) display.scroller.dragDrop();
3679 on(document, "mouseup", dragEnd);
3680 on(display.scroller, "drop", dragEnd);
3681 }
3682
3683 // Normal selection, as opposed to text dragging.
3684 function leftButtonSelect(cm, e, start, type, addNew) {

Callers 1

leftButtonDownFunction · 0.85

Calls 3

operationFunction · 0.85
extendSelectionFunction · 0.85
focusMethod · 0.80

Tested by

no test coverage detected