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

Function leftButtonDown

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

Source from the content-addressed store, hash-verified

2529
2530 var lastClick, lastDoubleClick;
2531 function leftButtonDown(cm, e, start) {
2532 setTimeout(bind(ensureFocus, cm), 0);
2533
2534 var now = +new Date, type;
2535 if (lastDoubleClick && lastDoubleClick.time > now - 400 && cmp(lastDoubleClick.pos, start) == 0) {
2536 type = "triple";
2537 } else if (lastClick && lastClick.time > now - 400 && cmp(lastClick.pos, start) == 0) {
2538 type = "double";
2539 lastDoubleClick = {time: now, pos: start};
2540 } else {
2541 type = "single";
2542 lastClick = {time: now, pos: start};
2543 }
2544
2545 var sel = cm.doc.sel, addNew = mac ? e.metaKey : e.ctrlKey;
2546 if (cm.options.dragDrop && dragAndDrop && !addNew && !isReadOnly(cm) &&
2547 type == "single" && sel.contains(start) > -1 && sel.somethingSelected())
2548 leftButtonStartDrag(cm, e, start);
2549 else
2550 leftButtonSelect(cm, e, start, type, addNew);
2551 }
2552
2553 // Start a text drag. When it ends, see if any dragging actually
2554 // happen, and treat as a click if it didn't.

Callers 1

onMouseDownFunction · 0.85

Calls 5

cmpFunction · 0.85
leftButtonStartDragFunction · 0.85
leftButtonSelectFunction · 0.85
bindFunction · 0.70
isReadOnlyFunction · 0.70

Tested by

no test coverage detected