MCPcopy Create free account
hub / github.com/sql-js/sql.js / leftButtonStartDrag

Function leftButtonStartDrag

GUI/codemirror/lib/codemirror.js:2585–2608  ·  view source on GitHub ↗
(cm, e, start)

Source from the content-addressed store, hash-verified

2583 // Start a text drag. When it ends, see if any dragging actually
2584 // happen, and treat as a click if it didn't.
2585 function leftButtonStartDrag(cm, e, start) {
2586 var display = cm.display;
2587 var dragEnd = operation(cm, function(e2) {
2588 if (webkit) display.scroller.draggable = false;
2589 cm.state.draggingText = false;
2590 off(document, "mouseup", dragEnd);
2591 off(display.scroller, "drop", dragEnd);
2592 if (Math.abs(e.clientX - e2.clientX) + Math.abs(e.clientY - e2.clientY) < 10) {
2593 e_preventDefault(e2);
2594 extendSelection(cm.doc, start);
2595 focusInput(cm);
2596 // Work around unexplainable focus problem in IE9 (#2127)
2597 if (ie_upto10 && !ie_upto8)
2598 setTimeout(function() {document.body.focus(); focusInput(cm);}, 20);
2599 }
2600 });
2601 // Let the drag handler handle this.
2602 if (webkit) display.scroller.draggable = true;
2603 cm.state.draggingText = dragEnd;
2604 // IE's approach to draggable
2605 if (display.scroller.dragDrop) display.scroller.dragDrop();
2606 on(document, "mouseup", dragEnd);
2607 on(display.scroller, "drop", dragEnd);
2608 }
2609
2610 // Normal selection, as opposed to text dragging.
2611 function leftButtonSelect(cm, e, start, type, addNew) {

Callers 1

leftButtonDownFunction · 0.85

Calls 4

operationFunction · 0.85
extendSelectionFunction · 0.85
focusInputFunction · 0.85
onFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…