MCPcopy
hub / github.com/witheve/Eve / onMouseDown

Function onMouseDown

src/codemirror.js:3586–3625  ·  view source on GitHub ↗
(e)

Source from the content-addressed store, hash-verified

3584 // middle-click-paste. Or it might be a click on something we should
3585 // not interfere with, such as a scrollbar or widget.
3586 function onMouseDown(e) {
3587 var cm = this, display = cm.display;
3588 if (signalDOMEvent(cm, e) || display.activeTouch && display.input.supportsTouch()) return;
3589 display.shift = e.shiftKey;
3590
3591 if (eventInWidget(display, e)) {
3592 if (!webkit) {
3593 // Briefly turn off draggability, to allow widgets to do
3594 // normal dragging things.
3595 display.scroller.draggable = false;
3596 setTimeout(function(){display.scroller.draggable = true;}, 100);
3597 }
3598 return;
3599 }
3600 if (clickInGutter(cm, e)) return;
3601 var start = posFromMouse(cm, e);
3602 window.focus();
3603
3604 switch (e_button(e)) {
3605 case 1:
3606 // #3261: make sure, that we're not starting a second selection
3607 if (cm.state.selectingText)
3608 cm.state.selectingText(e);
3609 else if (start)
3610 leftButtonDown(cm, e, start);
3611 else if (e_target(e) == display.scroller)
3612 e_preventDefault(e);
3613 break;
3614 case 2:
3615 if (webkit) cm.state.lastMiddleDown = +new Date;
3616 if (start) extendSelection(cm.doc, start);
3617 setTimeout(function() {display.input.focus();}, 20);
3618 e_preventDefault(e);
3619 break;
3620 case 3:
3621 if (captureRightClick) onContextMenu(cm, e);
3622 else delayBlurEvent(cm);
3623 break;
3624 }
3625 }
3626
3627 var lastClick, lastDoubleClick;
3628 function leftButtonDown(cm, e, start) {

Callers

nothing calls this directly

Calls 11

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

Tested by

no test coverage detected