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

Function onMouseDown

static/mergely/lib/codemirror.js:3565–3604  ·  view source on GitHub ↗
(e)

Source from the content-addressed store, hash-verified

3563 // middle-click-paste. Or it might be a click on something we should
3564 // not interfere with, such as a scrollbar or widget.
3565 function onMouseDown(e) {
3566 var cm = this, display = cm.display;
3567 if (signalDOMEvent(cm, e) || display.activeTouch && display.input.supportsTouch()) return;
3568 display.shift = e.shiftKey;
3569
3570 if (eventInWidget(display, e)) {
3571 if (!webkit) {
3572 // Briefly turn off draggability, to allow widgets to do
3573 // normal dragging things.
3574 display.scroller.draggable = false;
3575 setTimeout(function(){display.scroller.draggable = true;}, 100);
3576 }
3577 return;
3578 }
3579 if (clickInGutter(cm, e)) return;
3580 var start = posFromMouse(cm, e);
3581 window.focus();
3582
3583 switch (e_button(e)) {
3584 case 1:
3585 // #3261: make sure, that we're not starting a second selection
3586 if (cm.state.selectingText)
3587 cm.state.selectingText(e);
3588 else if (start)
3589 leftButtonDown(cm, e, start);
3590 else if (e_target(e) == display.scroller)
3591 e_preventDefault(e);
3592 break;
3593 case 2:
3594 if (webkit) cm.state.lastMiddleDown = +new Date;
3595 if (start) extendSelection(cm.doc, start);
3596 setTimeout(function() {display.input.focus();}, 20);
3597 e_preventDefault(e);
3598 break;
3599 case 3:
3600 if (captureRightClick) onContextMenu(cm, e);
3601 else delayBlurEvent(cm);
3602 break;
3603 }
3604 }
3605
3606 var lastClick, lastDoubleClick;
3607 function leftButtonDown(cm, e, start) {

Callers

nothing calls this directly

Calls 10

delayBlurEventFunction · 0.85
signalDOMEventFunction · 0.70
eventInWidgetFunction · 0.70
clickInGutterFunction · 0.70
posFromMouseFunction · 0.70
e_buttonFunction · 0.70
leftButtonDownFunction · 0.70
e_targetFunction · 0.70
extendSelectionFunction · 0.70
onContextMenuFunction · 0.70

Tested by

no test coverage detected