MCPcopy Create free account
hub / github.com/breck7/scroll / onMouseDown

Function onMouseDown

external/.scrollLibs.js:9972–10029  ·  view source on GitHub ↗
(e)

Source from the content-addressed store, hash-verified

9970 // middle-click-paste. Or it might be a click on something we should
9971 // not interfere with, such as a scrollbar or widget.
9972 function onMouseDown(e) {
9973 var cm = this,
9974 display = cm.display
9975 if (signalDOMEvent(cm, e) || (display.activeTouch && display.input.supportsTouch())) {
9976 return
9977 }
9978 display.input.ensurePolled()
9979 display.shift = e.shiftKey
9980
9981 if (eventInWidget(display, e)) {
9982 if (!webkit) {
9983 // Briefly turn off draggability, to allow widgets to do
9984 // normal dragging things.
9985 display.scroller.draggable = false
9986 setTimeout(function () {
9987 return (display.scroller.draggable = true)
9988 }, 100)
9989 }
9990 return
9991 }
9992 if (clickInGutter(cm, e)) {
9993 return
9994 }
9995 var pos = posFromMouse(cm, e),
9996 button = e_button(e),
9997 repeat = pos ? clickRepeat(pos, button) : "single"
9998 window.focus()
9999
10000 // #3261: make sure, that we're not starting a second selection
10001 if (button == 1 && cm.state.selectingText) {
10002 cm.state.selectingText(e)
10003 }
10004
10005 if (pos && handleMappedButton(cm, button, pos, repeat, e)) {
10006 return
10007 }
10008
10009 if (button == 1) {
10010 if (pos) {
10011 leftButtonDown(cm, pos, repeat, e)
10012 } else if (e_target(e) == display.scroller) {
10013 e_preventDefault(e)
10014 }
10015 } else if (button == 2) {
10016 if (pos) {
10017 extendSelection(cm.doc, pos)
10018 }
10019 setTimeout(function () {
10020 return display.input.focus()
10021 }, 20)
10022 } else if (button == 3) {
10023 if (captureRightClick) {
10024 cm.display.input.onContextMenu(e)
10025 } else {
10026 delayBlurEvent(cm)
10027 }
10028 }
10029 }

Callers

nothing calls this directly

Calls 12

signalDOMEventFunction · 0.85
eventInWidgetFunction · 0.85
clickInGutterFunction · 0.85
posFromMouseFunction · 0.85
e_buttonFunction · 0.85
clickRepeatFunction · 0.85
handleMappedButtonFunction · 0.85
leftButtonDownFunction · 0.85
e_targetFunction · 0.85
e_preventDefaultFunction · 0.85
extendSelectionFunction · 0.85
delayBlurEventFunction · 0.85

Tested by

no test coverage detected