MCPcopy Create free account
hub / github.com/TruthHun/BookStack / leftButtonDown

Function leftButtonDown

static/editor.md/lib/codemirror/lib/codemirror.js:3483–3505  ·  view source on GitHub ↗
(cm, e, start)

Source from the content-addressed store, hash-verified

3481
3482 var lastClick, lastDoubleClick;
3483 function leftButtonDown(cm, e, start) {
3484 if (ie) setTimeout(bind(ensureFocus, cm), 0);
3485 else ensureFocus(cm);
3486
3487 var now = +new Date, type;
3488 if (lastDoubleClick && lastDoubleClick.time > now - 400 && cmp(lastDoubleClick.pos, start) == 0) {
3489 type = "triple";
3490 } else if (lastClick && lastClick.time > now - 400 && cmp(lastClick.pos, start) == 0) {
3491 type = "double";
3492 lastDoubleClick = {time: now, pos: start};
3493 } else {
3494 type = "single";
3495 lastClick = {time: now, pos: start};
3496 }
3497
3498 var sel = cm.doc.sel, modifier = mac ? e.metaKey : e.ctrlKey, contained;
3499 if (cm.options.dragDrop && dragAndDrop && !isReadOnly(cm) &&
3500 type == "single" && (contained = sel.contains(start)) > -1 &&
3501 !sel.ranges[contained].empty())
3502 leftButtonStartDrag(cm, e, start, modifier);
3503 else
3504 leftButtonSelect(cm, e, start, type, modifier);
3505 }
3506
3507 // Start a text drag. When it ends, see if any dragging actually
3508 // happen, and treat as a click if it didn't.

Callers 1

onMouseDownFunction · 0.70

Calls 6

bindFunction · 0.70
ensureFocusFunction · 0.70
isReadOnlyFunction · 0.70
leftButtonStartDragFunction · 0.70
leftButtonSelectFunction · 0.70
cmpFunction · 0.50

Tested by

no test coverage detected