(cm, e, start)
| 3626 | |
| 3627 | var lastClick, lastDoubleClick; |
| 3628 | function leftButtonDown(cm, e, start) { |
| 3629 | if (ie) setTimeout(bind(ensureFocus, cm), 0); |
| 3630 | else cm.curOp.focus = activeElt(); |
| 3631 | |
| 3632 | var now = +new Date, type; |
| 3633 | if (lastDoubleClick && lastDoubleClick.time > now - 400 && cmp(lastDoubleClick.pos, start) == 0) { |
| 3634 | type = "triple"; |
| 3635 | } else if (lastClick && lastClick.time > now - 400 && cmp(lastClick.pos, start) == 0) { |
| 3636 | type = "double"; |
| 3637 | lastDoubleClick = {time: now, pos: start}; |
| 3638 | } else { |
| 3639 | type = "single"; |
| 3640 | lastClick = {time: now, pos: start}; |
| 3641 | } |
| 3642 | |
| 3643 | var sel = cm.doc.sel, modifier = mac ? e.metaKey : e.ctrlKey, contained; |
| 3644 | if (cm.options.dragDrop && dragAndDrop && !cm.isReadOnly() && |
| 3645 | type == "single" && (contained = sel.contains(start)) > -1 && |
| 3646 | (cmp((contained = sel.ranges[contained]).from(), start) < 0 || start.xRel > 0) && |
| 3647 | (cmp(contained.to(), start) > 0 || start.xRel < 0)) |
| 3648 | leftButtonStartDrag(cm, e, start, modifier); |
| 3649 | else |
| 3650 | leftButtonSelect(cm, e, start, type, modifier); |
| 3651 | } |
| 3652 | |
| 3653 | // Start a text drag. When it ends, see if any dragging actually |
| 3654 | // happen, and treat as a click if it didn't. |
no test coverage detected