(e)
| 57 | // middle-click-paste. Or it might be a click on something we should |
| 58 | // not interfere with, such as a scrollbar or widget. |
| 59 | export 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 | |
| 96 | function handleMappedButton(cm, button, pos, repeat, event) { |
| 97 | let name = "Click" |
nothing calls this directly
no test coverage detected