MCPcopy Create free account
hub / github.com/OpenEndedGroup/Field2 / onMouseDown

Function onMouseDown

lib/web/CodeMirror/src/edit/mouse_events.js:59–94  ·  view source on GitHub ↗
(e)

Source from the content-addressed store, hash-verified

57// middle-click-paste. Or it might be a click on something we should
58// not interfere with, such as a scrollbar or widget.
59export function onMouseDown(e) {
60 let cm = this, display = cm.display
61 if (signalDOMEvent(cm, e) || display.activeTouch && display.input.supportsTouch()) return
62 display.input.ensurePolled()
63 display.shift = e.shiftKey
64
65 if (eventInWidget(display, e)) {
66 if (!webkit) {
67 // Briefly turn off draggability, to allow widgets to do
68 // normal dragging things.
69 display.scroller.draggable = false
70 setTimeout(() => display.scroller.draggable = true, 100)
71 }
72 return
73 }
74 if (clickInGutter(cm, e)) return
75 let pos = posFromMouse(cm, e), button = e_button(e), repeat = pos ? clickRepeat(pos, button) : "single"
76 window.focus()
77
78 // #3261: make sure, that we're not starting a second selection
79 if (button == 1 && cm.state.selectingText)
80 cm.state.selectingText(e)
81
82 if (pos && handleMappedButton(cm, button, pos, repeat, e)) return
83
84 if (button == 1) {
85 if (pos) leftButtonDown(cm, pos, repeat, e)
86 else if (e_target(e) == display.scroller) e_preventDefault(e)
87 } else if (button == 2) {
88 if (pos) extendSelection(cm.doc, pos)
89 setTimeout(() => display.input.focus(), 20)
90 } else if (button == 3) {
91 if (captureRightClick) cm.display.input.onContextMenu(e)
92 else delayBlurEvent(cm)
93 }
94}
95
96function handleMappedButton(cm, button, pos, repeat, event) {
97 let name = "Click"

Callers

nothing calls this directly

Calls 15

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

Tested by

no test coverage detected