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

Function leftButtonDown

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

Source from the content-addressed store, hash-verified

2559
2560 var lastClick, lastDoubleClick;
2561 function leftButtonDown(cm, e, start) {
2562 setTimeout(bind(ensureFocus, cm), 0);
2563
2564 var now = +new Date, type;
2565 if (lastDoubleClick && lastDoubleClick.time > now - 400 && cmp(lastDoubleClick.pos, start) == 0) {
2566 type = "triple";
2567 } else if (lastClick && lastClick.time > now - 400 && cmp(lastClick.pos, start) == 0) {
2568 type = "double";
2569 lastDoubleClick = {time: now, pos: start};
2570 } else {
2571 type = "single";
2572 lastClick = {time: now, pos: start};
2573 }
2574
2575 var sel = cm.doc.sel, addNew = mac ? e.metaKey : e.ctrlKey;
2576 if (cm.options.dragDrop && dragAndDrop && !addNew && !isReadOnly(cm) &&
2577 type == "single" && sel.contains(start) > -1 && sel.somethingSelected())
2578 leftButtonStartDrag(cm, e, start);
2579 else
2580 leftButtonSelect(cm, e, start, type, addNew);
2581 }
2582
2583 // Start a text drag. When it ends, see if any dragging actually
2584 // happen, and treat as a click if it didn't.

Callers 1

onMouseDownFunction · 0.85

Calls 4

bindFunction · 0.85
isReadOnlyFunction · 0.85
leftButtonStartDragFunction · 0.85
leftButtonSelectFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…