(e)
| 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) { |
nothing calls this directly
no test coverage detected