MCPcopy
hub / github.com/csev/py4e / leftButtonStartDrag

Function leftButtonStartDrag

tools/pythonauto/static/codemirrorepl/codemirror.js:2555–2578  ·  view source on GitHub ↗
(cm, e, start)

Source from the content-addressed store, hash-verified

2553 // Start a text drag. When it ends, see if any dragging actually
2554 // happen, and treat as a click if it didn't.
2555 function leftButtonStartDrag(cm, e, start) {
2556 var display = cm.display;
2557 var dragEnd = operation(cm, function(e2) {
2558 if (webkit) display.scroller.draggable = false;
2559 cm.state.draggingText = false;
2560 off(document, "mouseup", dragEnd);
2561 off(display.scroller, "drop", dragEnd);
2562 if (Math.abs(e.clientX - e2.clientX) + Math.abs(e.clientY - e2.clientY) < 10) {
2563 e_preventDefault(e2);
2564 extendSelection(cm.doc, start);
2565 focusInput(cm);
2566 // Work around unexplainable focus problem in IE9 (#2127)
2567 if (ie_upto10 && !ie_upto8)
2568 setTimeout(function() {document.body.focus(); focusInput(cm);}, 20);
2569 }
2570 });
2571 // Let the drag handler handle this.
2572 if (webkit) display.scroller.draggable = true;
2573 cm.state.draggingText = dragEnd;
2574 // IE's approach to draggable
2575 if (display.scroller.dragDrop) display.scroller.dragDrop();
2576 on(document, "mouseup", dragEnd);
2577 on(display.scroller, "drop", dragEnd);
2578 }
2579
2580 // Normal selection, as opposed to text dragging.
2581 function leftButtonSelect(cm, e, start, type, addNew) {

Callers 1

leftButtonDownFunction · 0.85

Calls 6

onFunction · 0.85
operationFunction · 0.70
e_preventDefaultFunction · 0.70
extendSelectionFunction · 0.70
focusInputFunction · 0.70
offFunction · 0.50

Tested by

no test coverage detected